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 => })();

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 => })();

8 Responses

  1. BIll says:

    This script only downloads the first magnet link on a page.

  2. Alex says:

    Same. Doesn’t work unfortunatly.
    Only opens the topmost magnet on a tracker pager instead of every magnet.

    • Rabin says:

      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

  3. muhfkajones says:

    How do you make it download all the links? I must not be putting “*.torrent” in the right area

  4. muhfkajones says:

    have you figured out why the script only clicks the first magnet link on the page?

Leave a Reply

Your email address will not be published. Required fields are marked *