[thehentaiworld] adjust 'type' according to post URL

This commit is contained in:
Mike Fährmann
2025-09-23 20:04:58 +02:00
parent 889ecd7963
commit c095ff2d9b
2 changed files with 9 additions and 2 deletions

View File

@@ -60,14 +60,16 @@ class ThehentaiworldExtractor(Extractor):
"<li>Posted: ", "<"), "%Y-%m-%d"), "<li>Posted: ", "<"), "%Y-%m-%d"),
} }
if "/videos/" in url: if (c := url[27]) == "v":
post["type"] = "video" post["type"] = "video"
post["width"] = post["height"] = 0 post["width"] = post["height"] = 0
post["votes"] = text.parse_int(extr("(<strong>", "</strong>")) post["votes"] = text.parse_int(extr("(<strong>", "</strong>"))
post["score"] = text.parse_float(extr("<strong>", "<")) post["score"] = text.parse_float(extr("<strong>", "<"))
post["file_url"] = extr('<source src="', '"') post["file_url"] = extr('<source src="', '"')
else: else:
post["type"] = "image" post["type"] = ("animated" if c == "g" else
"3d cgi" if c == "3" else
"image")
post["width"] = text.parse_int(extr("<li>Size: ", " ")) post["width"] = text.parse_int(extr("<li>Size: ", " "))
post["height"] = text.parse_int(extr("x ", "<")) post["height"] = text.parse_int(extr("x ", "<"))
post["file_url"] = extr('a href="', '"') post["file_url"] = extr('a href="', '"')

View File

@@ -177,11 +177,16 @@ __tests__ = (
"#url" : "https://thehentaiworld.com/3d-cgi-hentai-images/ciri-and-shani-cekc-the-witcher-3/", "#url" : "https://thehentaiworld.com/3d-cgi-hentai-images/ciri-and-shani-cekc-the-witcher-3/",
"#class" : thehentaiworld.ThehentaiworldPostExtractor, "#class" : thehentaiworld.ThehentaiworldPostExtractor,
"#results" : "https://thehentaiworld.com/wp-content/uploads/2025/08/Ciri-and-Shani-CEKC-The-Witcher-3-Hentai-3D-CGI.jpeg", "#results" : "https://thehentaiworld.com/wp-content/uploads/2025/08/Ciri-and-Shani-CEKC-The-Witcher-3-Hentai-3D-CGI.jpeg",
"type" : "3d cgi",
}, },
{ {
"#url" : "https://thehentaiworld.com/gif-animated-hentai-images/rangiku-matsumoto-sketchdrif-bleach/", "#url" : "https://thehentaiworld.com/gif-animated-hentai-images/rangiku-matsumoto-sketchdrif-bleach/",
"#class" : thehentaiworld.ThehentaiworldPostExtractor, "#class" : thehentaiworld.ThehentaiworldPostExtractor,
"#results" : "https://thehentaiworld.com/wp-content/uploads/2025/05/Rangiku-Matsumoto-Sketchdrif-Bleach-Animated-Hentai.gif",
"type" : "animated",
}, },
{ {