From 761fc762f27e9d522f644a95a6ed6df8fdf7f501 Mon Sep 17 00:00:00 2001 From: lededev Date: Sun, 27 Mar 2022 20:38:36 +0800 Subject: [PATCH 1/3] =?UTF-8?q?KODI=E8=AF=84=E5=88=86=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=8A=95=E7=A5=A8=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebCrawler/javdb.py | 8 +++++--- core.py | 15 +++++++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/WebCrawler/javdb.py b/WebCrawler/javdb.py index 7bb6f3a..a0d8a38 100755 --- a/WebCrawler/javdb.py +++ b/WebCrawler/javdb.py @@ -175,7 +175,8 @@ def getSeries(html): def getUserRating(html): try: result = str(html.xpath('//span[@class="score-stars"]/../text()')[0]) - return result[:result.find('分')].strip() + v = re.findall(r'(\d+|\d+\.\d+)分, 由(\d+)人評價', result) + return float(v[0][0]), int(v[0][1]) except: return @@ -302,8 +303,9 @@ def main(number): } userrating = getUserRating(lx) - if userrating: - dic['userrating'] = userrating + if isinstance(userrating, tuple) and len(userrating) == 2: + dic['用户评分'] = userrating[0] + dic['评分人数'] = userrating[1] if not dic['actor'] and re.match(r'FC2-[\d]+', number, re.A): dic['actor'].append('素人') if not dic['series']: diff --git a/core.py b/core.py index befa3d5..3a64c06 100644 --- a/core.py +++ b/core.py @@ -355,10 +355,17 @@ def print_files(path, leak_word, c_word, naming_rule, part, cn_sub, json_data, f print(" " + release + "", file=code) print(" " + release + "", file=code) try: - f_rating = float(json_data['userrating']) - print(f" {round(f_rating * 2.0)}", file=code) - print(f" {round(f_rating * 2.0, 1)}", file=code) - print(f" {round(f_rating * 20.0, 1)}", file=code) + f_rating = json_data['用户评分'] + uc = json_data['评分人数'] + print(f""" {round(f_rating * 2.0)} + {round(f_rating * 2.0, 1)} + {round(f_rating * 20.0, 1)} + + + {f_rating} + {uc} + + """, file=code) except: pass print(" " + cover + "", file=code) From 99c068604afef6cffcd7a0192e01bab91c12e5cd Mon Sep 17 00:00:00 2001 From: lededev Date: Tue, 29 Mar 2022 23:39:52 +0800 Subject: [PATCH 2/3] madou.py:getTitle() bug fix --- WebCrawler/madou.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/WebCrawler/madou.py b/WebCrawler/madou.py index 57be3ea..67ffe93 100644 --- a/WebCrawler/madou.py +++ b/WebCrawler/madou.py @@ -19,9 +19,10 @@ def getTitle(html): # 获取标题 # MD0140-2 / 家有性事EP2 爱在身边-麻豆社 # MAD039 机灵可爱小叫花 强诱僧人迫犯色戒-麻豆社 # MD0094/贫嘴贱舌中出大嫂/坏嫂嫂和小叔偷腥内射受孕-麻豆社 + # TM0002-我的痴女女友-麻豆社 browser_title = str(html.xpath("/html/head/title/text()")[0]) - title = str(re.findall(r'^.*?( / | |/)(.*)-麻豆社$', browser_title)[0][1]).strip() - return title.replace('/', ' ') + title = str(re.findall(r'^[A-Z0-9 //\-]*(.*)-麻豆社$', browser_title)[0]).strip() + return title def getStudio(html): # 获取厂商 已修改 try: @@ -164,6 +165,8 @@ def main(number): if __name__ == '__main__': + config.G_conf_override['debug_mode:switch'] = True + print(main('TM0002')) print(main('MD0222')) print(main('MD0140-2')) print(main('MAD039')) From f83e756581b4ef70369f00d5ea9e10bbad7e70e8 Mon Sep 17 00:00:00 2001 From: lededev Date: Tue, 29 Mar 2022 23:46:40 +0800 Subject: [PATCH 3/3] madou.py:remove debug print --- WebCrawler/madou.py | 1 - 1 file changed, 1 deletion(-) diff --git a/WebCrawler/madou.py b/WebCrawler/madou.py index 67ffe93..6cf9132 100644 --- a/WebCrawler/madou.py +++ b/WebCrawler/madou.py @@ -61,7 +61,6 @@ def getNum(url, number): # 获取番号 filename = unquote(urlparse(url).path) # 裁剪文件名 result = filename[1:-5].upper().strip() - print(result) # 移除中文 if result.upper() != number.upper(): result = re.split(r'[^\x00-\x7F]+', result, 1)[0]