简单的178漫画下载器
自己写的漫画下载器 用来下载178完结漫画 用来保存
用法:把要下载的漫画地址复制到软件点击下载就是了
下完文件在软件目录中
from lxml import etree
import requests
import re
import execjs
import sys
import json
import os
from PIL import Image
class Spider():
def __init__(self, url):
self.tempurl = url
self.headers = {
'User-Agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
'cookie': 'UM_distinctid=1638b27abaf146-0b1d75740d4133-52693478-13c680-1638b27abb066; show_tip_1=0; CNZZDATA3470106=cnzz_eid%3D320706176-1532649440-https%253A%252F%252Fmanhua.dmzj.com%252F%26ntime%3D1533193311; CNZZDATA1000465408=1196428649-1527042905-https%253A%252F%252Fwww.baidu.com%252F%7C1539671806; CNZZDATA1000465515=1879849850-1527044952-https%253A%252F%252Fwww.baidu.com%252F%7C1539672264; display_mode=1; pt_s_198bb240=vt=1539672637572&cad=; pt_198bb240=uid=axDGwW5njubICm6c4HSMhA&nid=0&vid=M8Z/D4L7pD2pXmKvRYVo0A&vn=17&pvn=2&sact=1539672641787&to_flag=0&pl=J8gHIAMoYA2Eg1lD2m4zWQ*pt*1539672637572; CNZZDATA30043528=cnzz_eid%3D223015019-1533021818-https%253A%252F%252Fmanhua.dmzj.com%252F%26ntime%3D1539667867; CNZZDATA30039253=cnzz_eid%3D1296344247-1533023188-https%253A%252F%252Fmanhua.dmzj.com%252F%26ntime%3D1539671932'
}
self.zp={
}
def paseUrl(self,url):
r = requests.get(url, headers= self.headers)
return r.content.decode('utf-8')
# 得到所有漫画的所有话数和所有地址
def getManHualink(self,htmlstr):
htmlstr = etree.HTML(htmlstr)
links = htmlstr.xpath("//div[@class='cartoon_online_border']//li/a/@href")
links.append(htmlstr.xpath("//div[@style='display:none']//li/a/@href"))
title = htmlstr.xpath("//div[@class='cartoon_online_border']//li/a/@title")
manhuatitle = htmlstr.xpath("//span[@class='anim_title_text']/a/h1/text()")[0]
return title,links,manhuatitle
def getManHualink2(self,htmlstr):
htmlstr = etree.HTML(htmlstr)
links = htmlstr.xpath("//div[@class='tab-content tab-content-selected zj_list_con autoHeight']//li/a/@href")
title = htmlstr.xpath("//div[@class='tab-content tab-content-selected zj_list_con autoHeight']//li/a/@title")
manhuatitle = htmlstr.xpath("//div[@class='comic_deCon']/h1/a/text()")[0]
return title,links,manhuatitle
# 保存漫画
def saveFile(se