Greasy Fork

Greasy Fork is available in English.

旧版哔嘀影视下载链接复制

一键复制 bde4 所有 ed2k 下载链接

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         旧版哔嘀影视下载链接复制
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  一键复制 bde4 所有 ed2k 下载链接
// @author       zsandianv
// @include      https://www.52bdys.com/*
// @exclude      https://www.52bdys.com/play/*
// @exclude      https://www.52bdys.com/*/play
// @icon         https://cdn.jsdelivr.net/gh/bde4admin/v3/images/favicon.png
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var host = window.location.href
    var api = 'https://www.52bdys.com/downloadInfo/list?mid='
    var mid = host.match(/\d+/g)[1]
    var data
    var ed2k = []
    var magnet = []

    $.ajaxSettings.async = false;
    $.getJSON(api + mid, function(json){
        data = json
    });
    for (var i in data){
        if (!data[i].url.search('ed2k')){
            var password = ''
            if (data[i].password == 'none'){
                password = ''
            }
            ed2k.push([data[i].downloadCategory.name,data[i].url,password])
        }else if (!data[i].url.search('magnet')){
            magnet.push([data[i].downloadCategory.name,data[i].url,data[i].password])
        }
    }
    if (magnet.length != 0){
        for (i in magnet){
            html = html + format(magnet[i][0],magnet[i][1],magnet[i][2])
            console.log(1)
        }
    }
    if (ed2k.length != 0){
        ed2k.reverse()
        for (i in ed2k){
            html = html + format(ed2k[i][0],ed2k[i][1],ed2k[i][2])
            console.log(1)
        }
    }

    function format(name,url,password){
        var item = '<div class="item"><div class="content"><a class="parent"target="_blank"href="'+url+'><em class="left"style="color: red">'+name+':</em><em class="right ui text nowrap"title="'+url+'">'+url+'</em><em style="color:red">'+password+'</em></a></div></div>'
        return item
    }
    if ($("div#download-wrapper").length == 0){
        var html = '<div id="download-wrapper"style="display: block;"><h4 class="ui teal header dividing"><div class="content">下载地址<small style="color:#db2828">(请优先使用种子文件下载)</small></div></h4><div class="ui middle aligned animated list"id="download-list">'
        html = html + '</div></div>'
        $("div.download-help").before(html)
    }

    $("div#download-wrapper .ui.teal.header.dividing .content").after('<button class="ui secondary mini button" type="submit" id="btn_submit"> 复制链接 </button>')

    $('#btn_submit').click(function(){
        var url = [];$('em.right.ui.text.nowrap').each(function(index,element){if(!element.innerText.search('ed2k')){url.push(element.innerText)}})
        var copyUrl = document.createElement('textarea');
        copyUrl.style.opacity	=0;
        copyUrl.style.position="absolute";
        copyUrl.style.left="100%";
        document.getElementById("btn_submit").appendChild(copyUrl);
        copyUrl.value = url;
        copyUrl.select();
        document.execCommand('copy')
        document.getElementById("btn_submit").removeChild(copyUrl);

    });




    // Your code here...
})();