[warosu] Simpler/less costly hostname check

This commit is contained in:
NecRaul
2025-06-20 14:26:04 +04:00
parent 3c85032b9b
commit 5ba7c98bc2

View File

@@ -39,7 +39,7 @@ class WarosuThreadExtractor(Extractor):
yield Message.Directory, data yield Message.Directory, data
for post in posts: for post in posts:
if "image" in post and "warosu" in post["image"]: if "image" in post:
for key in ("w", "h", "no", "time", "tim"): for key in ("w", "h", "no", "time", "tim"):
post[key] = text.parse_int(post[key]) post[key] = text.parse_int(post[key])
dt = text.parse_timestamp(post["time"]) dt = text.parse_timestamp(post["time"])
@@ -98,6 +98,8 @@ class WarosuThreadExtractor(Extractor):
if url: if url:
if url[0] == "/": if url[0] == "/":
data["image"] = self.root + url data["image"] = self.root + url
elif "warosu." not in url:
return False
else: else:
data["image"] = url data["image"] = url
return True return True