Skip to content

Commit

Permalink
Add: download original size for tumblr. #82
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Dec 4, 2017
1 parent 9008c58 commit 133a162
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions comiccrawler/mods/tumblr.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ def get_images(html, url):
if "image" not in o:
raise SkipEpisodeError
if isinstance(o["image"], str):
return [o["image"]]
return o["image"]["@list"]
return transform(o["image"])
return [transform(u) for u in o["image"]["@list"]]

def transform(url):
"""Map thumbnail to full size"""
# https://github.com/eight04/ComicCrawler/issues/82
url = re.sub("[^/]+\.tumblr\.com", "data.tumblr.com", url)
url = re.sub("_\d+(\.\w+)$", r"_raw\1", url)
return url

def get_next_page(html, url):
match = re.search(r'/page/(\d+)', url)
Expand Down

0 comments on commit 133a162

Please sign in to comment.