diff --git a/nhentai/doujinshi.py b/nhentai/doujinshi.py index 578ec25..b947102 100644 --- a/nhentai/doujinshi.py +++ b/nhentai/doujinshi.py @@ -65,7 +65,7 @@ class Doujinshi(object): ['Groups', self.info.groups], ['Languages', self.info.languages], ['Tags', self.info.tags], - ['Favorite Counts', self.info.favorite_counts], + ['Favorite Counts', self.favorite_counts], ['URL', self.url], ['Pages', self.pages], ] diff --git a/nhentai/parser.py b/nhentai/parser.py index ab30235..3a6da76 100644 --- a/nhentai/parser.py +++ b/nhentai/parser.py @@ -141,14 +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 = str(doujinshi_info.find('span', class_='nobold').find('span', class_='count')) - if favorite_counts is None: - favorite_counts = '0' + favorite_counts = doujinshi_info.find('span', class_='nobold').find('span', class_='count') doujinshi['name'] = title doujinshi['pretty_name'] = pretty_name doujinshi['subtitle'] = subtitle.text if subtitle else '' - doujinshi['favorite_counts'] = favorite_counts.strip() + doujinshi['favorite_counts'] = int(favorite_counts.text.strip()) if favorite_counts else 0 doujinshi_cover = html.find('div', attrs={'id': 'cover'}) # img_id = re.search('/galleries/([0-9]+)/cover.(jpg|png|gif|webp)$', diff --git a/nhentai/utils.py b/nhentai/utils.py index c38063f..341859f 100644 --- a/nhentai/utils.py +++ b/nhentai/utils.py @@ -338,7 +338,7 @@ def generate_metadata_file(output_dir, doujinshi_obj): fields = ['TITLE', 'ORIGINAL TITLE', 'AUTHOR', 'ARTIST', 'GROUPS', 'CIRCLE', 'SCANLATOR', 'TRANSLATOR', 'PUBLISHER', 'DESCRIPTION', 'STATUS', 'CHAPTERS', 'PAGES', - 'TAGS', 'TYPE', 'LANGUAGE', 'RELEASED', 'READING DIRECTION', 'CHARACTERS', + 'TAGS', 'FAVORITE COUNTS', 'TYPE', 'LANGUAGE', 'RELEASED', 'READING DIRECTION', 'CHARACTERS', 'SERIES', 'PARODY', 'URL'] temp_dict = CaseInsensitiveDict(dict(doujinshi_obj.table))