您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Adds a download link to songs on Bandcamp
当前为
// ==UserScript== // @name Bandcamp Downloader // @namespace https://github.com/whqwert/userscripts // @version 1.0.5 // @description Adds a download link to songs on Bandcamp // @author whqwert // @match https://*.bandcamp.com/* // @icon https://s4.bcbits.com/img/favicon/favicon-32x32.png // @supportURL https://github.com/whqwert/userscripts/issues // @license MIT // @grant GM_download // ==/UserScript== (function () { 'use strict'; const table = document.querySelectorAll('#track_table > tbody > tr'); const adata = unsafeWindow.TralbumData || false; if (adata) { const albutton = document.querySelector('.share-collect-controls > ul'); const downloadButtonHTML = `<li id="download-button"> <span class="bc-ui2 share-embed-icon" style=" clip-path: polygon(65% 0%, 15% 50%, 15% 85%, 65% 80%, 100% 37%); transform: rotate(90deg) scale(1.06); "></span> <span class="share-embed-label"> <button type="button"> Download </button> </span> </li>`; function downloadSong(file, title) { GM_download({ url: file, name: adata.artist + ' - ' + title + '.mp3', saveAs: true }); } if (table.length) { // isAlbum const dlinks = document.getElementsByClassName('dl_link'); adata.trackinfo.forEach((track, i) => { const link = dlinks[i]; const file = track.file['mp3-128']; const title = track.title; link.innerHTML = `<a href="${file}" title="${adata.artist + ' - ' + title}"> download </a>`; link.firstChild.onclick = () => { downloadSong(file, title); return false; }; }); } else { // isSong const file = unsafeWindow.TralbumData.trackinfo[0].file['mp3-128']; albutton.insertAdjacentHTML('beforeend', downloadButtonHTML); document.getElementById('download-button').onclick = () => { downloadSong(file, adata.current.title); }; } } })();