[poipiku] always query 'ShowAppendFileF' when post has warning (#6736)

This commit is contained in:
Mike Fährmann
2024-12-27 20:07:24 +01:00
parent bc7e95684d
commit 7391dd208c
2 changed files with 25 additions and 5 deletions

View File

@@ -52,20 +52,23 @@ class PoipikuExtractor(Extractor):
}
yield Message.Directory, post
post["num"] = 0
post["num"] = warning = 0
while True:
thumb = extr('class="IllustItemThumbImg" src="', '"')
if not thumb:
break
elif thumb.startswith(("//img.poipiku.com/img/", "/img/")):
if "/warning" in thumb:
warning = True
self.log.debug("%s: %s", post["post_id"], thumb)
continue
post["num"] += 1
url = text.ensure_http_scheme(thumb[:-8]).replace(
"//img.", "//img-org.", 1)
yield Message.Url, url, text.nameext_from_url(url, post)
if not extr('ShowAppendFile', '<'):
if not warning and not extr('ShowAppendFile', '<'):
continue
url = self.root + "/f/ShowAppendFileF.jsp"
@@ -87,7 +90,8 @@ class PoipikuExtractor(Extractor):
page = resp["html"]
if (resp.get("result_num") or 0) < 0:
self.log.warning("'%s'", page.replace("<br/>", " "))
self.log.warning("%s: '%s'",
post["post_id"], page.replace("<br/>", " "))
for thumb in text.extract_iter(
page, 'class="IllustItemThumbImg" src="', '"'):

View File

@@ -48,8 +48,8 @@ __tests__ = (
"#count" : 4,
"count" : 4,
"num" : range(1, 4),
"description" : "絵茶の産物ネタバレあるやつ",
"num" : int,
"post_category": "SPOILER",
"post_id" : "6411749",
"user_id" : "2166245",
@@ -65,12 +65,28 @@ __tests__ = (
"#count" : 3,
"count" : 3,
"num" : range(1, 3),
"description" : "ORANGE OASISボスネタバレ<br />曲も大好き<br />2枚目以降はほとんど見えなかった1枚目背景のヒエログリフ小ネタです𓀀",
"num" : int,
"post_category": "SPOILER",
"post_id" : "5776587",
"user_id" : "3572553",
"user_name" : "nagakun",
},
{
"#url" : "https://poipiku.com/1400760/5483268.html",
"#comment" : "Warning and no 'Show all' button (#6736)",
"#category": ("", "poipiku", "post"),
"#class" : poipiku.PoipikuPostExtractor,
"#urls" : "https://img-org.poipiku.com/user_img02/001400760/005483268_JdB7sAWpv.jpeg",
"count" : 1,
"num" : 1,
"description" : "えち描く描く詐欺ずっとやってるのですこしかいてた<br />ほたしか写ってないよ",
"post_category": "TRAINING",
"post_id" : "5483268",
"user_id" : "1400760",
"user_name" : "onitsuraaaai",
},
)