From c1163b70ad18a09667665d6aa173e503e6250a38 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Thu, 16 Jan 2025 17:37:19 +0100 Subject: backend/plugins: Do not explicitly require source in anchira.to scraper We've come across info.yaml files without this field. If it is missing, instead rely on a simple heuristic. --- src/hircine/plugins/scrapers/anchira.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hircine/plugins/scrapers/anchira.py b/src/hircine/plugins/scrapers/anchira.py index baee4bd..bb60ac9 100644 --- a/src/hircine/plugins/scrapers/anchira.py +++ b/src/hircine/plugins/scrapers/anchira.py @@ -19,7 +19,7 @@ from hircine.scraper.types import ( ) from hircine.scraper.utils import open_archive_file, parse_dict -URL_REGEX = re.compile(r"^https?://anchira\.to/g/") +SOURCE_REGEX = re.compile(r"^https?://anchira\.to/g/") class AnchiraYamlScraper(Scraper): @@ -45,8 +45,14 @@ class AnchiraYamlScraper(Scraper): self.data = self.load() source = self.data.get("Source") - if source and re.match(URL_REGEX, source): + if source and re.match(SOURCE_REGEX, source): self.is_available = True + elif not source: + # heuristic, but should be good enough + url = self.data.get("URL") + parody = self.data.get("Parody") + + self.is_available = url is not None and parody is not None def load(self): try: -- cgit v1.2.3-2-gb3c3