diff --git a/Find Unique Titles/dist/find.unique.titles.user.js b/Find Unique Titles/dist/find.unique.titles.user.js index 988faf4..5cb17a0 100644 --- a/Find Unique Titles/dist/find.unique.titles.user.js +++ b/Find Unique Titles/dist/find.unique.titles.user.js @@ -1828,6 +1828,7 @@ var common_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../common/dist/logger/index.mjs"); var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([ _utils_cache__WEBPACK_IMPORTED_MODULE_5__ ]); _utils_cache__WEBPACK_IMPORTED_MODULE_5__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0]; + const BANNED_RELEASE_GROUPS = [ "aXXo", "BMDRu", "BRrip", "CM8", "CrEwSaDe", "CTFOH", "d3g", "DNL", "FaNGDiNG0", "HD2DVD", "HDTime", "ION10", "iPlanet", "KiNGDOM", "mHD", "mSD", "nHD", "nikt0", "nSD", "NhaNc3", "OFT", "PRODJi", "SANTi", "SPiRiT", "STUTTERSHIT", "ViSION", "VXT", "WAF", "x0r", "YIFY", "OFT", "BHDStudio", "nikt0", "HDT", "LAMA", "WORLD", "SasukeducK", "SPiRiT" ]; function isSupportedCategory(category) { return void 0 === category || category === _tracker__WEBPACK_IMPORTED_MODULE_0__.Category.MOVIE || category === _tracker__WEBPACK_IMPORTED_MODULE_0__.Category.DOCUMENTARY || category === _tracker__WEBPACK_IMPORTED_MODULE_0__.Category.LIVE_PERFORMANCE; } @@ -1862,6 +1863,10 @@ common_logger__WEBPACK_IMPORTED_MODULE_2__.logger.debug("[PTP] Torrent not allowed: non HDR X265 and not 2160p"); return false; } + if (BANNED_RELEASE_GROUPS.includes(torrent.releaseGroup)) { + common_logger__WEBPACK_IMPORTED_MODULE_2__.logger.debug(`[PTP] Torrent not allowed: banned release group: ${torrent.releaseGroup}`); + return false; + } return true; }; class PTP extends _tracker__WEBPACK_IMPORTED_MODULE_0__.AbstractTracker { @@ -2345,7 +2350,8 @@ tags: (0, _utils_utils__WEBPACK_IMPORTED_MODULE_2__.parseTags)(torrentTitle), dom: element, resolution: (0, _utils_utils__WEBPACK_IMPORTED_MODULE_2__.parseResolution)(torrentTitle), - container: (0, _utils_utils__WEBPACK_IMPORTED_MODULE_2__.parseCodec)(torrentTitle) + container: (0, _utils_utils__WEBPACK_IMPORTED_MODULE_2__.parseCodec)(torrentTitle), + releaseGroup: (0, _utils_utils__WEBPACK_IMPORTED_MODULE_2__.parseReleaseGroup)(torrentTitle) } ], dom: [ element ], imdbId, @@ -2940,6 +2946,7 @@ parseContainerAndFormat: () => parseContainerAndFormat, parseImdbId: () => parseImdbId, parseImdbIdFromLink: () => parseImdbIdFromLink, + parseReleaseGroup: () => parseReleaseGroup, parseResolution: () => parseResolution, parseSize: () => parseSize, parseTags: () => parseTags, @@ -3064,6 +3071,13 @@ const match = title.match(regex); if (match) return parseInt(match[1], 10); }; + const parseReleaseGroup = title => { + const lastDashIndex = title.lastIndexOf("-"); + if (-1 === lastDashIndex || lastDashIndex === title.length - 1) return null; + const maybeGroup = title.substring(lastDashIndex + 1).trim(); + if (maybeGroup.includes(" ")) return null; + return maybeGroup; + }; }, "../common/dist/dom/index.mjs": (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.d(__webpack_exports__, { diff --git a/Find Unique Titles/src/trackers/PTP.ts b/Find Unique Titles/src/trackers/PTP.ts index d442a2d..974ed64 100644 --- a/Find Unique Titles/src/trackers/PTP.ts +++ b/Find Unique Titles/src/trackers/PTP.ts @@ -20,6 +20,47 @@ import { findFirst, insertBefore } from "common/dom"; import { fetchAndParseHtml } from "common/http"; import { logger } from "common/logger"; +const BANNED_RELEASE_GROUPS = [ + "aXXo", + "BMDRu", + "BRrip", + "CM8", + "CrEwSaDe", + "CTFOH", + "d3g", + "DNL", + "FaNGDiNG0", + "HD2DVD", + "HDTime", + "ION10", + "iPlanet", + "KiNGDOM", + "mHD", + "mSD", + "nHD", + "nikt0", + "nSD", + "NhaNc3", + "OFT", + "PRODJi", + "SANTi", + "SPiRiT", + "STUTTERSHIT", + "ViSION", + "VXT", + "WAF", + "x0r", + "YIFY", + "OFT", + "BHDStudio", + "nikt0", + "HDT", + "LAMA", + "WORLD", + "SasukeducK", + "SPiRiT", +]; + function isSupportedCategory(category: Category | undefined) { return ( category === undefined || @@ -94,6 +135,12 @@ const isAllowedTorrent = (torrent: Torrent) => { logger.debug("[PTP] Torrent not allowed: non HDR X265 and not 2160p"); return false; } + if (BANNED_RELEASE_GROUPS.includes(torrent.releaseGroup)) { + logger.debug( + `[PTP] Torrent not allowed: banned release group: ${torrent.releaseGroup}` + ); + return false; + } return true; }; diff --git a/Find Unique Titles/src/trackers/TL.ts b/Find Unique Titles/src/trackers/TL.ts index a63fac1..a00d1fc 100644 --- a/Find Unique Titles/src/trackers/TL.ts +++ b/Find Unique Titles/src/trackers/TL.ts @@ -1,6 +1,6 @@ import { parseCodec, - parseImdbIdFromLink, + parseImdbIdFromLink, parseReleaseGroup, parseResolution, parseSize, parseTags, parseYearAndTitle @@ -63,6 +63,7 @@ export default class TL extends AbstractTracker { dom: element as HTMLElement, resolution: parseResolution(torrentTitle), container: parseCodec(torrentTitle), + releaseGroup: parseReleaseGroup(torrentTitle) }, ], dom: [element as HTMLElement], diff --git a/Find Unique Titles/src/trackers/tracker.ts b/Find Unique Titles/src/trackers/tracker.ts index 6d81d30..14ba763 100644 --- a/Find Unique Titles/src/trackers/tracker.ts +++ b/Find Unique Titles/src/trackers/tracker.ts @@ -5,6 +5,7 @@ export interface Torrent { format?: string | null; resolution?: Resolution; dom: HTMLElement; + releaseGroup?: string; } export enum Resolution { diff --git a/Find Unique Titles/src/utils/utils.ts b/Find Unique Titles/src/utils/utils.ts index d3894cd..93ef770 100644 --- a/Find Unique Titles/src/utils/utils.ts +++ b/Find Unique Titles/src/utils/utils.ts @@ -35,7 +35,9 @@ export const parseImdbId = (text: string) => { return results[0]; }; -export const parseResolution = (text: string|undefined): Resolution | undefined => { +export const parseResolution = ( + text: string | undefined +): Resolution | undefined => { if (!text) return undefined; const resolutionsAndAliases: Record = { SD: ["sd", "pal", "ntsc"], @@ -156,3 +158,13 @@ export const parseYear = (title: string) => { const match = title.match(regex); if (match) return parseInt(match[1], 10); }; + +export const parseReleaseGroup = (title: string): string | null => { + const lastDashIndex = title.lastIndexOf("-"); + if (lastDashIndex === -1 || lastDashIndex === title.length - 1) { + return null; + } + const maybeGroup = title.substring(lastDashIndex + 1).trim(); + if (maybeGroup.includes(" ")) return null; + return maybeGroup; +};