2 Commits
0.3.1 ... 0.3.2

Author SHA1 Message Date
wenead99
b5f82f77a1 0.3.2 Beta 完善错误提示 2019-05-29 12:10:16 +08:00
wenead99
5f627d24e0 0.3.1 Beta 修改无法导出nfo文件和介绍BUG 2019-05-29 09:07:17 +08:00

16
core.py
View File

@@ -12,13 +12,11 @@ import time
#=====================爬虫核心部分==========================
def get_html(url):#网页请求核心
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'}
getweb = requests.get(str(url),proxies={"http": "http://127.0.0.1:2334","https": "https://127.0.0.1:2334"},timeout=5,headers=headers).text
getweb = requests.get(str(url),timeout=5,headers=headers).text
try:
return getweb
except Exception as e:
print(e)
except IOError as e1:
print(e1)
except:
print("[-]Connect Failed! Please check your Proxy.")
def getTitle(htmlcode): #获取标题
doc = pq(htmlcode)
@@ -85,7 +83,7 @@ def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in
print("[-]Download Failed2!")
time.sleep(3)
os._exit(0)
def PrintFiles(html,path):
def PrintFiles(html,path,number):
try:
if not os.path.exists(path):
os.makedirs(path)
@@ -96,8 +94,8 @@ def PrintFiles(html,path):
print(" </set>", file=code)
print(" <studio>" + getStudio(html) + "+</studio>", file=code)
print(" <year>" + getYear(html) + "</year>", file=code)
print(" <outline>"+getOutline(html)+"</outline>", file=code)
print(" <plot>"+getOutline(html)+"</plot>", file=code)
print(" <outline>"+getOutline(get_html_dww(number))+"</outline>", file=code)
print(" <plot>"+getOutline(get_html_dww(number))+"</plot>", file=code)
print(" <runtime>"+str(getRuntime(html)).replace(" ","")+"</runtime>", file=code)
print(" <director>" + getDirector(html) + "</director>", file=code)
print(" <poster>" + getNum(html) + ".png</poster>", file=code)
@@ -196,6 +194,6 @@ if __name__ == '__main__':
htmlcode=get_html_javbus(number) #获取的HTML代码
creatFolder(htmlcode,number) #创建文件夹
imageDownload(htmlcode,filepath,number) #creatFoder会返回番号路径
PrintFiles(htmlcode, path)#打印文件
PrintFiles(htmlcode, path,number)#打印文件
cutImage(number) #裁剪图
pasteFileToFolder(filepath,number,path) #移动文件