Greasy Fork

Greasy Fork is available in English.

Xunlei Remote Batch Add for dydytt.net

Auto add downloadlinks to clipboard for dydytt.net

当前为 2021-09-03 提交的版本,查看 最新版本

// ==UserScript==
// @name         Xunlei Remote Batch Add for dydytt.net
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Auto add downloadlinks to clipboard for dydytt.net
// @author       [email protected]
// @match        https://www.dydytt.net/*
// @icon         https://www.google.com/s2/favicons?domain=dydytt.net
// @grant   GM_setClipboard
// ==/UserScript==

function isUrl(uri){
    var re = new RegExp("^(magnet:\?xt=urn:btih:)[0-9a-fA-F]{40}.*$");
    if(re.test(uri))return true;
    re = new RegExp("(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]");
    if(re.test(uri))return true;
    return false;
}

(function() {
    'use strict';
    var list = [];
    var sources = document.querySelectorAll("#Zoom a[thunderpid]");
    for(var i in sources){
        if(isUrl(sources[i].innerText)){
            list.push(sources[i].innerText);
        }
    }
    if(list.length>0){
        GM_setClipboard(list.join("\n"));
    }
})();