nhentai: Galleries with broken thumbnail urls are generating .webp files with html content.
After webp images started showing up, I noticed a few galleries were pulling in broken webp images. On closer inspection, the downloaded files contain html that show a 404 error.
Example 538028, the first thumbnail is referencing an invalid url:
/galleries/3115455/1t.jpg.webp
Looks like an issue with nhentai. I can remove the .webp extension from the thumbnail url
/galleries/3115455/1t.jpg
and the thumbnail image will load in.
The broken thumnail links to page 1 of the doujin and does indeed have a working image:
/galleries/3115455/1.jpg
So this broken thumnail might be messing up the parsing somehow. When comming accross these broken thumbnails, I think it attempts to download
/galleries/3115455/1.webp
which does not exist, the actual file is
/galleries/3115455/1.jpg
and this successfully saves as a .webp file, but the contents are the html of the 404 error.
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
I’m thinking this might be a parsing logic issue if the thumbnail url is somehow used to determine the file extension of the downloaded image file.
This only affects around 5 galleries at the moment.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (5 by maintainers)
Commits related to this issue
- fix #349 — committed to RicterZ/nhentai by RicterZ 2 years ago
- fix #349 — committed to zYxDevs/nhentai by RicterZ 2 years ago
workaround
Find the files from nhentai in your python folder, “AppData\Local\Programs\Python\Python312\Lib\site-packages\nhentai” is mine for example, should be about the same unless you installed it differently. doujinshi.py - parser.py - utils.py Open them with notepad or some text editor and look for the lines that the commit changed and edit them to look the same, that’s what I did at least, since just replacing them didn’t work in my case.
f30ff59 - look for the differences and the number at the left of the line or just find it without, edit them, save and try if it works. If it doesn’t, maybe replacing them works for you.