From 248d31edf01ec74d9b7f889723a770b484d21e01 Mon Sep 17 00:00:00 2001 From: ricterzheng Date: Mon, 3 Feb 2025 15:45:39 +0800 Subject: [PATCH] get favorite count #386 even if not login --- nhentai/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nhentai/parser.py b/nhentai/parser.py index 3a6da76..a0e1932 100644 --- a/nhentai/parser.py +++ b/nhentai/parser.py @@ -141,12 +141,12 @@ def doujinshi_parser(id_, counter=0): title = doujinshi_info.find('h1').text pretty_name = doujinshi_info.find('h1').find('span', attrs={'class': 'pretty'}).text subtitle = doujinshi_info.find('h2') - favorite_counts = doujinshi_info.find('span', class_='nobold').find('span', class_='count') + favorite_counts = doujinshi_info.find('span', class_='nobold').text.strip('(').strip(')') doujinshi['name'] = title doujinshi['pretty_name'] = pretty_name doujinshi['subtitle'] = subtitle.text if subtitle else '' - doujinshi['favorite_counts'] = int(favorite_counts.text.strip()) if favorite_counts else 0 + doujinshi['favorite_counts'] = int(favorite_counts) if favorite_counts and favorite_counts.isdigit() else 0 doujinshi_cover = html.find('div', attrs={'id': 'cover'}) # img_id = re.search('/galleries/([0-9]+)/cover.(jpg|png|gif|webp)$',