Skip to content

Commit

Permalink
fix bug of cover.webp.webp
Browse files Browse the repository at this point in the history
  • Loading branch information
RicterZ committed Feb 25, 2025
1 parent 8a7be0e commit 6789b2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion nhentai/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def cmd_parser():

parser.add_option('--no-filename-padding', action='store_true', dest='no_filename_padding',
default=False, help='no padding in the images filename, such as \'001.jpg\'')
parser.add_option('--only-meta', action='store_true', dest='only_meta', default=False,
help='only download doujinshi metadata')

# generate options
parser.add_option('--html', dest='html_viewer', action='store_true',
Expand Down Expand Up @@ -188,7 +190,6 @@ def cmd_parser():

if any([args.cookie, args.useragent, args.language]):
sys.exit(0)
# -- end set config

if args.proxy is not None:
proxy_url = urlparse(args.proxy)
Expand Down
4 changes: 3 additions & 1 deletion nhentai/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def doujinshi_parser(id_, counter=0):
doujinshi_cover = html.find('div', attrs={'id': 'cover'})
# img_id = re.search('/galleries/([0-9]+)/cover.(jpg|png|gif|webp)$',
# doujinshi_cover.a.img.attrs['data-src'])
img_id = re.search(r'/galleries/(\d+)/cover\.\w+$', doujinshi_cover.a.img.attrs['data-src'])

# fix cover.webp.webp
img_id = re.search(r'/galleries/(\d+)/cover(.webp)?\.\w+$', doujinshi_cover.a.img.attrs['data-src'])

ext = []
for i in html.find_all('div', attrs={'class': 'thumb-container'}):
Expand Down

0 comments on commit 6789b2b

Please sign in to comment.