Created
March 18, 2019 01:18
-
-
Save juusechec/d6ae6ab1fb8e1830b59947e46ffb53ea to your computer and use it in GitHub Desktop.
Descargar manga de http://www.animextremist.com/mangas.htm
This file contains hidden or 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
#!/usr/bin/env python3 | |
import os | |
import urllib.request | |
def create_path(dir): | |
if not os.path.isdir(dir): | |
os.mkdir(dir) | |
def file_exists(file): | |
return os.path.isfile(file) | |
def download(capitulo, pagina): | |
carpeta = 'Capítulo' + str(capitulo) | |
archivo = 'Imagen' + str(pagina).zfill(3) + '.jpg' | |
pagina = '' if pagina is 1 else str(pagina) | |
capitulo = str(capitulo) | |
create_path(carpeta) | |
ruta_archivo = os.path.join(carpeta, archivo) | |
print('ruta_archivo:', ruta_archivo) | |
if file_exists(ruta_archivo): | |
return True | |
url = 'http://myanx.com/mangas-online/hunter-x-hunter/capitulo-{}/hunterxhunter{}.jpg'.format(capitulo, pagina) | |
print('url:', url) | |
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.3'} | |
req = urllib.request.Request(url=url, headers=headers) | |
resource = urllib.request.urlopen(req) | |
content = resource.read() | |
file_size = len(content) | |
print('file_size:', len(content)) | |
if file_size < 5: | |
return False | |
output = open(ruta_archivo,'wb') | |
output.write(content) | |
output.close() | |
return True | |
for capitulo in range(1, 341): | |
for pagina in range(1, 100): | |
if not download(capitulo, pagina): | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we lo que te quiero chabon... años buscando para bajar un manga que solo estaba en buena calidad en ANX y no queria bajar uno por uno. Genial es script y bien simple