Last active
November 12, 2024 09:05
-
-
Save douglashsilva/b62ff36dd6f8f46ecf65c81898540800 to your computer and use it in GitHub Desktop.
Search for all hidden magnet on torrent blocking pages | Obs: Only run on the console where the page is with torrent blocking
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
// Search for all hidden Torrent Magnet URL on pages | |
function searchAllMagnet(){ | |
// Search Torrent Magnet URL on Attributes | |
function searchMagnet(dom){ | |
let trim = (str) => String(str).toString().trim(), magnet = [], regex = /^magnet\:\?.*$/gim | |
dom = trim(dom) | |
if(dom.textContent && regex.test(dom)) magnet.push(dom.textContent) | |
Array.from(dom.attributes) | |
.filter((value) => regex.test(trim(value))) | |
.map(({ nodeValue }) => magnet.push(trim(nodeValue))) | |
return magnet.length >= 1 ? magnet : false | |
} | |
// Call Search on DOM | |
let dom = Array.from(document.querySelectorAll("a, span, div, li, i, td, tr, textarea")) | |
.filter((dom) => searchMagnet(dom)) | |
.map((dom) => searchMagnet(dom)) | |
// Display Found's | |
if(dom.length >= 1){ | |
dom.map((array) => array.map((magnet) => console.log(`Found: ${magnet} \n`))) | |
}else{ | |
console.log(`Not Found!\n`) | |
} | |
} | |
// Run !!! | |
searchAllMagnet() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment