[hentaifoundry] fix '.swf' file downloads (#4641)

This commit is contained in:
Mike Fährmann
2023-10-09 11:44:14 +02:00
parent 15f940819b
commit 9a008523ac
2 changed files with 55 additions and 5 deletions

View File

@@ -72,13 +72,11 @@ class HentaifoundryExtractor(Extractor):
extr = text.extract_from(page, page.index('id="picBox"'))
data = {
"index" : text.parse_int(path.rsplit("/", 2)[1]),
"title" : text.unescape(extr('class="imageTitle">', '<')),
"artist" : text.unescape(extr('/profile">', '<')),
"width" : text.parse_int(extr('width="', '"')),
"height" : text.parse_int(extr('height="', '"')),
"index" : text.parse_int(path.rsplit("/", 2)[1]),
"src" : text.urljoin(self.root, text.unescape(extr(
'src="', '"'))),
"_body" : extr(
'<div class="boxbody"', '<div class="boxfooter"'),
"description": text.unescape(text.remove_html(extr(
'>Description</div>', '</section>')
.replace("\r\n", "\n"), "", "")),
@@ -92,6 +90,20 @@ class HentaifoundryExtractor(Extractor):
">Tags </span>", "</div>")),
}
body = data["_body"]
if "<object " in body:
data["src"] = text.urljoin(self.root, text.unescape(text.extr(
body, 'name="movie" value="', '"')))
data["width"] = text.parse_int(text.extr(
body, "name='width' value='", "'"))
data["height"] = text.parse_int(text.extr(
body, "name='height' value='", "'"))
else:
data["src"] = text.urljoin(self.root, text.unescape(text.extr(
body, 'src="', '"')))
data["width"] = text.parse_int(text.extr(body, 'width="', '"'))
data["height"] = text.parse_int(text.extr(body, 'height="', '"'))
return text.nameext_from_url(data["src"], data)
def _parse_story(self, html):