Download All Torrent Magnet Links In A Page
If you’re lucky and have search engine which list the results with their magnet links, and you found the right query to list only the torrent you are looking for, one can use this bookmarklet to easily “click” on all the magnet links in the page, which if you associate the magnet URI handling to your torrent client, and allowed the auto-open action in the browser, will fill you torrent client with all the torrents in a single click.
javascript:(function(){ document.querySelectorAll("a[href^='magnet:']").forEach(element => element.click()) })();
Create bookmark and set the above line as the page destination.
Here we’re using the querySelectorAll
to filter all elements from the DOM which are type of a
(hyperlink) with the attribute href (the link destination) and it values start with magnet:
and then for each we simulate a click action.
One can easily adapt this line to click all the links with *.torrent
extension.
javascript:(function(){ document.querySelectorAll("a[href$='.torrent']").forEach(element => element.click()) })();
This script only downloads the first magnet link on a page.
I will need to see the page to understand why.
Same. Doesn’t work unfortunatly.
Only opens the topmost magnet on a tracker pager instead of every magnet.
You can debug this with the browser dev tool, open the console and type the command, and see what happen. You can debug each section, e.g. list all the links, with magent ref
and see what is the output
How do you make it download all the links? I must not be putting “*.torrent” in the right area
You need to change the filter from
href^='magnet:'
tohref$='.torrent'
have you figured out why the script only clicks the first magnet link on the page?
Can you send me a link to an example page?