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)