qobuz-bulk-downloader/qobuz_bulk_downloader.js

37 lines
1.3 KiB
JavaScript

// ==UserScript==
// @name Qobuz Batch Downloader
// @namespace https://git.evilchi.li/evilchili/qobuz-bulk-downloader
// @version 2024-09-05
// @description Fuck you and your downloader app.
// @author evilchili
// @match https://www.qobuz.com/account/download/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=qobuz.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
var btn = document.createElement('div');
btn.innerHTML = "<a id='QBD_download_all'>DOWNLOAD ALL TRACKS</a>";
btn.setAttribute("class", "btn-white");
document.querySelector('.product-title').appendChild(btn);
document.getElementById('QBD_download_all').addEventListener('click', () => {
var links = document.querySelectorAll('.tracks');
var index = 0;
const click_interval = setInterval(function() {
links[index].click();
index++;
if (index == links.length) {
clearInterval(click_interval);
}
}, 3000);
const cover_link = Array.from(document.getElementsByTagName('a')).filter(function (el) { return el.href.indexOf("/cover") > 0 });
if (cover_link.length > 0) {
cover_link[0].click();
}
});
})();