summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorWolfgang Müller2025-01-16 17:37:19 +0100
committerWolfgang Müller2025-01-16 18:20:37 +0100
commitc1163b70ad18a09667665d6aa173e503e6250a38 (patch)
treef07e00b983718cd99c6375a5e63c683f2c164143
parent387550086a00b5a1b8221c1528e6f616430e7b3c (diff)
downloadhircine-c1163b70ad18a09667665d6aa173e503e6250a38.tar.gz
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.
-rw-r--r--src/hircine/plugins/scrapers/anchira.py10
1 files 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: