[8chan] fix file urls

This commit is contained in:
Mike Fährmann
2016-10-15 23:06:54 +02:00
parent ffc3c2d32c
commit a33b13c631
2 changed files with 14 additions and 4 deletions

View File

@@ -37,17 +37,21 @@ class ChanThreadExtractor(Extractor):
if "filename" not in post:
continue
self.update(post)
yield Message.Url, self.file_url.format_map(post), post
yield Message.Url, self.build_url(post), post
if "extra_files" in post:
for file in post["extra_files"]:
self.update(post, file)
yield Message.Url, self.file_url.format_map(post), post
yield Message.Url, self.build_url(post), post
def update(self, post, data=None):
"""Update keyword dictionary"""
post.update(data or self.metadata)
post["extension"] = post["ext"][1:]
def build_url(self, post):
"""Construct an image url out of a post object"""
return self.file_url.format_map(post)
@staticmethod
def get_thread_title(post):
"""Return thread title from first post"""