Open shinji257 opened 1 year ago
After some digging replacing
width = self.browser.execute_script(
f"return document.getElementsByTagName('canvas')[{n-2}].width"
)
height = self.browser.execute_script(
f"return document.getElementsByTagName('canvas')[{n-2}].height"
)
With
width = self.browser.execute_script(
f"return document.getElementsByClassName('layer')[{n-2}].firstChild.width"
)
height = self.browser.execute_script(
f"return document.getElementsByClassName('layer')[{n-2}].firstChild.height"
)
in downloader.py may be viable. Currently testing but it seems to work. When looking in Firefox (and Chrome) the former gave the values for the wrong element for some reason (not your scripts fault!) but the latter seemed to give the correct size. You may know better than me on this.
Testing: (Known good -- https://www.fakku.net/hentai/1-on-5-english) (Problem example)
May be the same issue as #13 but hard to say since they indicate it is random. I was able to reproduce consistently.
Example: https://www.fakku.net/hentai/cat-studio-r18-part-1-english
For some reason it gets the wrong width and height for these pages. There are a bunch of others that are affected as well.
If I remove (comment) the block then it grabs the whole image but it is getting more canvas than it should (because it isn't resizing anymore). The image sizes it detects for the pages is 300x150 for the cover and 300x424 for the other pages.
If I load the doujin in a normal login session it gives appropriate data that I'd expect.
Platform: Windows 11 Python: 3.10.5 ChromeDriver 110.0.5481.77