Bandcamp mp3s direct downloader

Show direct download link for the preview files on bandcamp albums

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Bandcamp mp3s direct downloader
// @description Show direct download link for the preview files on bandcamp albums
// @include     https://*.bandcamp.com/*
// @grant       none
// @version 0.0.1.20171111104401
// @namespace https://greasyfork.org/users/2290
// ==/UserScript==



    // Insert links into track list
    window.setTimeout(function() {
      if(TralbumData && TralbumData.hasAudio && !TralbumData.freeDownloadPage && TralbumData.trackinfo) {
        var i = 0;
        var hoverdiv = document.querySelectorAll(".download-col div");
        TralbumData.trackinfo.forEach(function(t) {
          for (var prop in t.file) {
            var mp3 = t.file[prop].replace(/^\/\//,"http://");
            var a = document.createElement("a");
            a.href = mp3;
            a.target = "_blank"; // Listen to another window
            a.download = "mp3-128k.mp3"; // Force the download
            a.appendChild(document.createTextNode(prop));
            hoverdiv[i++].appendChild(a);
            break;
          }
        });
      }
    },200);