Last active
April 21, 2018 20:30
-
-
Save FdelMazo/655c479d359fc48d32bafd2835c4269d to your computer and use it in GitHub Desktop.
JL8 comics downloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, zipfile | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(requests.get("http://limbero.org/jl8").content, "lxml") | |
latest_issue = int(soup.title.string.split(' ')[0][1:]) | |
FIRST = 0 | |
LAST = latest_issue | |
COVER = 'http://static.tvtropes.org/pmwiki/pub/images/rsz_tumblr_or2whrxrgs1r7ni1io1_1280.jpg' | |
with open('JL8_0.jpg', "wb") as f: | |
f.write(requests.get(COVER).content) | |
print("Downloaded: Cover Page") | |
downloads = ['JL8_0.jpg'] | |
for i in range(FIRST+1, LAST + 1): | |
url = 'http://limbero.org/jl8/{}'.format(i) | |
soup = BeautifulSoup(requests.get(url).content, "lxml") | |
for link in soup.findAll(alt="Comic"): | |
title = "JL8_"+link.get('src').split('/')[-1] | |
downloads.append(title) | |
r = requests.get(link.get('src')) | |
with open(title, "wb") as f: | |
f.write(r.content) | |
print("Downloaded: {}".format(title)) | |
zf = zipfile.ZipFile("JL8.cbz", "w") | |
for img in downloads: | |
zf.write(img) | |
zf.close() | |
print('JL8.cbz created') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment