Last active
March 18, 2025 18:29
-
-
Save zhimiaoli/fc7c22a27feaa2cbf9ec4563fe860d30 to your computer and use it in GitHub Desktop.
在bt4g.org的页面上直接显示磁力添加下载地址
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name bt4g Magnet direct show | |
// @namespace http://tampermonkey.net/ | |
// @version 0.3 | |
// @description 在bt4g.org的页面上直接显示磁力添加下载地址,现在仅支持详情页。 | |
// @author lizhimiao | |
// @match https://bt4g.org/magnet/* | |
// @match https://bt4gprx.com/magnet/* | |
// @icon https://www.google.com/s2/favicons?domain=bt4g.org | |
// @grant none | |
// @updateURL https://gist.github.com/zhimiaoli/fc7c22a27feaa2cbf9ec4563fe860d30/raw/bt4g_Magnet_direct_show.user.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var linkDOM = document.querySelector("body > main > div > div:nth-child(2) > div > table:nth-child(3) > tbody > tr > th > a"); | |
if (linkDOM) { | |
console.log("page sinle"); | |
var link = document.querySelector("a[href^='\//downloadtorrentfile.com/hash\/']"); | |
var hash = link.href.replace("https://downloadtorrentfile.com/hash/","").replace("?name","&dn"); | |
linkDOM.href = "magnet:?xt=urn:btih:" + hash; | |
} | |
/* comment out list page function. | |
function appendLink(item) { | |
var d = document.createElement("a"); | |
d.href=item.href; | |
d.target="_blank"; | |
d.innerHTML = "🔗"; | |
item.parentNode.insertBefore(d,item.nextSibling); | |
//console.log(item.href.replace("/magnet/","magnet:?xt=urn:btih:").replace("https://bt4g.org","")); | |
//item.href = item.href.replace("https://bt4g.org",""); | |
console.log(item.href); | |
item.href = item.href.replace(/.*magnet\//,"magnet:?xt=urn:btih:"); | |
//.replace("https\:\/\/bt4gprx\.com",""); | |
} | |
var links = document.querySelectorAll("a[href^='\/magnet\/']"); | |
links.forEach(appendLink); | |
*/ | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it‘s work