bcrawlink

Provides links to the raw media files for previews on bandcamp to get around preview listen limits. Also allows you to easily download the previews. >:)

当前为 2016-08-12 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        bcrawlink
// @description Provides links to the raw media files for previews on bandcamp to get around preview listen limits.  Also allows you to easily download the previews.  >:)
// @license     MIT License
// @namespace   com.bandcamp.benburrill.evil
// @include     *
// @version     1
// @grant       none
// ==/UserScript==

// BTW, we run this on all sites because some bandcamp pages are not actually on bandcamp.org

$(document).ready(function() {
    window.TralbumData && TralbumData.trackinfo.forEach(function(track, index) {
        // I've only seen the mp3 type, but if there happen to be more, we want to
        // make links for all of them.
        track.file && Object.keys(track.file).forEach(function(media_type) {
            var cls = `raw-link-${media_type}`;
            var base = `(tr,div)[rel="tracknum=${index+1}"]`;
            var pref_child = "td.title-col";

            // If possible, use the child pref_child instead of base.
            if ($(base).has(pref_child).length) base += `>${pref_child}`;

            $(`${base}:not(:has(a.${cls}))`).each(function() {
                $(this).append(
                    `<a class="${cls}" href="${track.file[media_type]}" target="_blank">
                        ${media_type}
                    </a>`
                );
            });
        });
    });
});