1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2025-01-31 11:41:35 +01:00

[toyhouse] fix Content Warning bypass (#5820)

This commit is contained in:
Mike Fährmann 2024-07-04 00:46:58 +02:00
parent e03b99ba0e
commit 162756b684
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -77,23 +77,27 @@ class ToyhouseExtractor(Extractor):
cnt += 1
yield self._parse_post(post)
if cnt == 0 and params["page"] == 1:
token, pos = text.extract(
page, '<input name="_token" type="hidden" value="', '"')
if not token:
return
data = {
"_token": token,
"user" : text.extract(page, 'value="', '"', pos)[0],
}
self.request(self.root + "/~account/warnings/accept",
method="POST", data=data, allow_redirects=False)
continue
if not cnt and params["page"] == 1:
if self._accept_content_warning(page):
continue
return
if cnt < 18:
return
params["page"] += 1
def _accept_content_warning(self, page):
pos = page.find(' name="_token"') + 1
token, pos = text.extract(page, ' value="', '"', pos)
user , pos = text.extract(page, ' value="', '"', pos)
if not token or not user:
return False
data = {"_token": token, "user": user}
self.request(self.root + "/~account/warnings/accept",
method="POST", data=data, allow_redirects=False)
return True
class ToyhouseArtExtractor(ToyhouseExtractor):
"""Extractor for artworks of a toyhouse user"""