19Jan

Seedless: Hide Unseeded Torrents on Tokyotosho Using Tampermonkey

Posted by Elf Sternberg as Uncategorized

I’m sure a lot of people need this, but not many would write it.  This is a tampermonkey script (tampermonkey is like greasemonkey, only for Chrome); Tampermonkey is an extension that lets you modify pages on the fly as they’re coming back from a server using Javascript.  Tokyo Tosho is my favorite torrent site for scanlated manga and anime, but they have a bit of a problem: they have no way to filter out anything on the list that isn’t seeded (i.e. isn’t really available).

The script below is a Tampermonkey script, raw.  What it does is fairly obvious: it finds the “Seeds: 0” token and filters out any entries in which that appears.  TokyoTosho’s layout is a bit old-school, so it took some fiddling but it works, and it saves me a bit of time.

Use at your own risk.

function seedless() {   
  var stats = document.querySelectorAll('.stats');
  var lines = [];
  for(var i = 0, l = stats.length; i < l; ++i) { 
    lines.push(stats.item(i)); 
  }
  
  lines = lines
    .map(function(a) { 
      return [a, a.innerText.match(/S\:\s+(\d+)/)]; })
    .filter(function(a) { 
      return (parseInt(a[1][1], 10) == 0); })
    .forEach(
      function(a) { 
        var p = a[0].parentElement;
        p.previousSibling.style.display = 'none';
        p.style.display = 'none';
      });
}

setTimeout(seedless, 500);

Comment Form

Subscribe to Feed

Categories

Calendar

January 2015
M T W T F S S
« Dec   Feb »
 1234
567891011
12131415161718
19202122232425
262728293031