diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index 2584d3f..0cb1c0f 100644 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -6,7 +6,7 @@ import sys from ADC_function import * import json -version='0.10.3' +version='0.10.4' def UpdateCheck(): html2 = get_html('https://raw.githubusercontent.com/wenead99/AV_Data_Capture/master/update_check.json') diff --git a/core.py b/core.py index 2a15c9c..31f77c8 100644 --- a/core.py +++ b/core.py @@ -204,13 +204,13 @@ def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in print("[-]Download Failed2!") time.sleep(3) os._exit(0) -def PrintFiles(path): +def PrintFiles(path,naming_rule): try: if not os.path.exists(path): os.makedirs(path) with open(path + "/" + naming_rule + ".nfo", "wt", encoding='UTF-8') as code: print("", file=code) - print(" " + title + "", file=code) + print(" " + naming_rule + "", file=code) print(" ", file=code) print(" ", file=code) print(" " + studio + "+", file=code) @@ -255,15 +255,15 @@ def PrintFiles(path): print(e1) print("[-]Write Failed!") def imageDownload(filepath): #封面是否下载成功,否则移动到failed - if DownloadFileWithFilename(cover,naming_rule+ '.jpg', path) == 'failed': + if DownloadFileWithFilename(cover,'Backdrop.jpg', path) == 'failed': shutil.move(filepath, 'failed/') os._exit(0) - DownloadFileWithFilename(cover, naming_rule + '.jpg', path) - print('[+]Image Downloaded!', path +'/'+naming_rule+'.jpg') + DownloadFileWithFilename(cover, 'Backdrop.jpg', path) + print('[+]Image Downloaded!', path +'/'+'Backdrop.jpg') def cutImage(): if imagecut == 1: try: - img = Image.open(path + '/' + naming_rule + '.jpg') + img = Image.open(path + '/' + 'Backdrop' + '.jpg') imgSize = img.size w = img.width h = img.height @@ -272,7 +272,7 @@ def cutImage(): except: print('[-]Cover cut failed!') else: - img = Image.open(path + '/' + naming_rule + '.jpg') + img = Image.open(path + '/' + 'Backdrop' + '.jpg') w = img.width h = img.height img.save(path + '/' + naming_rule + '.png') @@ -287,6 +287,6 @@ if __name__ == '__main__': getNumberFromFilename(filepath) #定义番号 creatFolder() #创建文件夹 imageDownload(filepath) #creatFoder会返回番号路径 - PrintFiles(path)#打印文件 + PrintFiles(path,naming_rule)#打印文件 cutImage() #裁剪图 pasteFileToFolder(filepath,path) #移动文件 diff --git a/javbus.py b/javbus.py index bca16ec..4054e81 100644 --- a/javbus.py +++ b/javbus.py @@ -15,7 +15,11 @@ import siro def getTitle(htmlcode): #获取标题 doc = pq(htmlcode) title=str(doc('div.container h3').text()).replace(' ','-') - return title + try: + title2 = re.sub('n\d+-','',title) + return title2 + except: + return title def getStudio(htmlcode): #获取厂商 html = etree.fromstring(htmlcode,etree.HTMLParser()) result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[5]/a/text()')).strip(" ['']") @@ -121,7 +125,7 @@ def main_uncensored(number): htmlcode = get_html('https://www.javbus.com/' + number) dww_htmlcode = get_html("https://www.dmm.co.jp/mono/dvd/-/detail/=/cid=" + number.replace("-", '')) dic = { - 'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))), + 'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))).replace(getNum(htmlcode)+'-',''), 'studio': getStudio(htmlcode), 'year': getYear(htmlcode), 'outline': getOutline(dww_htmlcode), @@ -141,7 +145,7 @@ def main_uncensored(number): number2 = number.replace('-', '_') htmlcode = get_html('https://www.javbus.com/' + number2) dic2 = { - 'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))), + 'title': str(re.sub('\w+-\d+-','',getTitle(htmlcode))).replace(getNum(htmlcode)+'-',''), 'studio': getStudio(htmlcode), 'year': getYear(htmlcode), 'outline': '',