Skip to content

Instantly share code, notes, and snippets.

@The0x539
Last active September 3, 2019 17:44
Show Gist options
  • Save The0x539/14a6113f7838392d667748e3e2b0b8f2 to your computer and use it in GitHub Desktop.
Save The0x539/14a6113f7838392d667748e3e2b0b8f2 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Nyaa: filter out garbage
// @namespace Violentmonkey Scripts
// @match https://nyaa.si/
// @grant none
// ==/UserScript==
let blockedTags = [
'JAM_CLUB',
'StreamAnime',
'Ohys-Raws',
'Leopard-Raws',
'NSBC',
'PuyaSubs!',
'ASTARIA-ANIME',
'Lilith-Raws',
'Anime Land',
['【悠哈璃羽字幕社】', 'as-is']
]
let match = (tag, title) =>
typeof tag == 'string' ? title.startsWith('[' + tag + ']') :
tag[1] == 'as-is' ? title.startsWith(tag[0]) :
false;
let shouldFilter = title => blockedTags
.map(tag => match(tag, title))
.includes(true);
let list = document.getElementsByClassName('torrent-list')[0].children[1].children;
let toRemove = [];
for (let row of list) {
let foo = row.children[1].children;
let title = foo[foo.length - 1].title;
if (shouldFilter(title)) {
toRemove.push(row);
}
}
for (let row of toRemove) {
row.remove();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment