From 41342a6da0322b38dac150ef6fc9018164c107dd Mon Sep 17 00:00:00 2001 From: ricterzheng Date: Sun, 8 Dec 2024 12:31:58 +0800 Subject: [PATCH] fix #359 --- nhentai/parser.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nhentai/parser.py b/nhentai/parser.py index 4060bfb..bb6f43f 100644 --- a/nhentai/parser.py +++ b/nhentai/parser.py @@ -142,7 +142,13 @@ 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').text.strip() + favorite_counts = doujinshi_info.find('span', class_='nobold').find('span', class_='count')\ + + if favorite_counts: + favorite_counts = favorite_counts.text.strip() + else: + favorite_counts = 0 + doujinshi['name'] = title doujinshi['pretty_name'] = pretty_name doujinshi['subtitle'] = subtitle.text if subtitle else ''