Last active
October 26, 2024 12:52
-
-
Save zhimiaoli/fc7c22a27feaa2cbf9ec4563fe860d30 to your computer and use it in GitHub Desktop.
在bt4g.org的页面上直接显示磁力添加下载地址
This file contains 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); | |
*/ | |
})(); |
updated,dropped support for list page ,now only support detail page.
I have the same problem, Bt4g used to put the file hash values in the search result page as a part of the result links, and I could easily grab them then generate full magnet links (I added a button with the magnet link beside each result). But later they changed all the hash values in the search page to encrypted strings, now I have to check the result link pages to have the right magnet link, inconveniently.
I'm not a pro, AI told me those encrypted strings cannot be reversed, what do you think?
已经失效了 能否更新一下脚本
not work
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not work