Created
November 18, 2023 14:57
-
-
Save olijf/abef8c39317a8f2dd707e8a7ad2ed395 to your computer and use it in GitHub Desktop.
Greasemonkey userscript to add a download link to iTorrents caching service
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 BtDig.com to iTorrent | |
// @version 1.0 | |
// @description Adds link to itorrent file | |
// @match https://btdig.com/*/* | |
// ==/UserScript== | |
function _x(STR_XPATH) { | |
var xresult = document.evaluate(STR_XPATH, document, null, XPathResult.ANY_TYPE, null); | |
var xnodes = []; | |
var xres; | |
while (xres = xresult.iterateNext()) { | |
xnodes.push(xres); | |
} | |
return xnodes; | |
} | |
(function() { | |
'use strict'; | |
var child = _x('/html/body/center/div[1]/div/center/table/tbody/tr[4]/td[2]') | |
var downloadUrl = document.createElement('a') | |
downloadUrl.setAttribute('href', 'https://itorrents.org/torrent/' + encodeURI(window.location.pathname.split('/')[1]) + '.torrent') | |
downloadUrl.innerHTML = '⭳ Download from iTorrents!' | |
child[0].append(document.createElement('br')) | |
child[0].append(downloadUrl) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment