[sankaku] fix swf extraction (closes #52)

This commit is contained in:
Mike Fährmann 2017-12-07 15:45:43 +01:00
parent ebe9b0a04c
commit a3924d2072
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -88,12 +88,17 @@ class SankakuTagExtractor(Extractor):
"""Collect metadata for a single image"""
url = "https://chan.sankakucomplex.com/post/show/" + image_id
page = self.request(url, retries=10).text
image_url, pos = text.extract(page, '<li>Original: <a href="', '"')
file_url, pos = text.extract(page, '<li>Original: <a href="', '"')
if file_url:
width , pos = text.extract(page, '>', 'x', pos)
height, pos = text.extract(page, '', ' ', pos)
data = text.nameext_from_url(image_url, {
else:
width , pos = text.extract(page, '<object width=', ' ', pos)
height, pos = text.extract(page, 'height=', '>', pos)
file_url = text.extract(page, '<embed src="', '"', pos)[0]
data = text.nameext_from_url(file_url, {
"id": util.safe_int(image_id),
"file_url": "https:" + text.unescape(image_url),
"file_url": "https:" + text.unescape(file_url),
"width": util.safe_int(width),
"height": util.safe_int(height),
})