nixx's magnet link tool for pantsu.cat

turns the magnet links on pantsu.cat's nyaa backup into nixx's shit tool

  1. // ==UserScript==
  2. // @name nixx's magnet link tool for pantsu.cat
  3. // @namespace https://greasyfork.org/en/users/3372-nixxquality
  4. // @version 1.0
  5. // @description turns the magnet links on pantsu.cat's nyaa backup into nixx's shit tool
  6. // @author nixx <nixx@is-fantabulo.us>
  7. // @match https://nyaa.pantsu.cat/*
  8. // @match https://sukebei.pantsu.cat/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var xtregex = /xt=([^&]+)/;
  16. var dnregex = /dn=([^&]+)/;
  17.  
  18. [].forEach.call(document.getElementsByTagName("a"), function(item) {
  19. if (item.href.startsWith("magnet")) {
  20. var xtmatch = item.href.match(xtregex);
  21. var dnmatch = item.href.match(dnregex);
  22.  
  23. if (xtmatch !== null) {
  24. item.href = "https://nixx.is-fantabulo.us/magnet_with_trackers.html#" + xtmatch[1] + "#" + dnmatch[1];
  25. }
  26. }
  27. });
  28.  
  29. })();