Skip to content

Instantly share code, notes, and snippets.

@ptrcnull
Last active April 9, 2024 02:44
Show Gist options
  • Save ptrcnull/da7813d2e9b8b591e7fc40890b028408 to your computer and use it in GitHub Desktop.
Save ptrcnull/da7813d2e9b8b591e7fc40890b028408 to your computer and use it in GitHub Desktop.
Hide Fake Torrents on The Pirate Bay (fixed)
// ==UserScript==
// @name Hide Fake Torrents on The Pirate Bay
// @namespace https://www.reddit.com/r/Piracy/comments/4w0qix/now_that_kat_is_gone_i_wrote_a_small_script_that/
// @version 2.1
// @description Hide Fake Torrents on The Pirate Bay with Conditional Logic
// @author https://www.reddit.com/user/nicobelic & Bjornskjald
// @match https://thepiratebay.org/*
// @grant none
// @locale English
// ==/UserScript==
(function() {
// Change the values below if you want
const maxSeedsWithoutTrust = 1000
const trustedTorrentsOnly = false
const hideUntrustedTorrentsWithoutComments = true
const hidePorn = true
const hideFrench = true
const hideTelesyncsAndCams = true
const dontHideJustWarn = true
const disableThisCompletely = false
// Don't touch anything past this point
if (disableThisCompletely) return
function hide (torrent) {
torrent.style.display = "none"
}
function warn (torrent) {
torrent.style.background = '#fbbdbd'
}
var torrents = Array.from(document.querySelectorAll('#searchResult tbody tr'))
torrents.map(torrent => {
if (typeof torrent === 'undefined') return
if (hidePorn &&
torrent.querySelector('td:nth-child(1)').innerText.includes('Porn')) return torrent
if (hideFrench &&
torrent.querySelector('td .detLink').innerText.toLowerCase().includes('french')) return torrent
if (hideTelesyncsAndCams &&
['hdcam', ' cam ', 'hd-ts', 'hdts', 'camrip'].map(el => torrent.querySelectorAll('td .detLink')[0].innerText.toLowerCase().contains(el)).some(el => el)) return torrent
if (!torrent.innerHTML.match(/alt="VIP"|alt="Trusted"/) &&
(trustedTorrentsOnly || parseInt(torrent.querySelector('td:nth-child(3)').innerText) >= maxSeedsWithoutTrust)) return torrent
}).filter(el => el).map(dontHideJustWarn ? hide : warn)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment