Greasy Fork is available in English.

Free download from soundsnap.com

Download audio directly from Soundsnap

// ==UserScript==
// @name         Free download from soundsnap.com
// @name:en      Free download from soundsnap.com
// @name:ru      Бесплатное скачивание с soundsnap.com
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Download audio directly from Soundsnap
// @description:en  Free audio download from soundsnap.com.
// @description:ru  Бесплатная загрузка аудио с сайта soundsnap.com.
// @author       Sidiusz
// @match        https://www.soundsnap.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Функция для скрытия кнопки скачивания и удаления атрибута href
    const hideDownloadButton = (button) => {
        if (!button) return;
        button.style.display = 'none';
        button.removeAttribute('href');
    };

    // Создаем экземпляр MutationObserver для отслеживания изменений в DOM
    const observer = new MutationObserver(mutations => {
        for (const mutation of mutations) {
            if (mutation.type === 'childList') {
                for (const node of mutation.addedNodes) {
                    // Проверяем, если добавлен ребенок является элементом управления загрузкой
                    if (node.matches && node.matches('a.ojoo-icon-download')) {
                        hideDownloadButton(node);
                    }
                    // Проверяем, если добавленный ребенок содержит элементы управления загрузкой
                    else if (node.nodeType === Node.ELEMENT_NODE) {
                        const downloadButtons = node.querySelectorAll('a.ojoo-icon-download');
                        downloadButtons.forEach(hideDownloadButton);
                    }
                    // Включаем кнопку скачивания, когда аудио загружено
                    if (node.tagName === 'AUDIO') {
                        const audioSrc = node.getAttribute('src');
                        const downloadButton = node.closest('.ojoo-teaser').querySelector('a.ojoo-icon-download');
                        if (downloadButton) {
                            downloadButton.href = new URL(audioSrc, window.location.origin).href;
                            downloadButton.style.display = 'inline-block';
                        }
                    }
                }
            }
        }
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();