Cyberes / vitalsource2pdf

Ultra-high quality PDFs from VitalSource.
GNU Affero General Public License v3.0
48 stars 11 forks source link

total_pages error #5

Open room-homage opened 10 months ago

room-homage commented 10 months ago

Traceback (most recent call last): line 115, in     load_book_page(page_num) line 91, in load_book_page     get_num_pages()  # Wait for the page to load line 75, in get_num_pages     total = int(driver.execute_script('return document.getElementsByClassName("'+platform_identifiers['total_pages']+'")[0].innerHTML').strip().split('/')[-1].strip()) KeyError: 'total_pages'

itsmalter commented 10 months ago

The dictionary is broken because of typos. There is a "," missing and a ":" in lines 55 and 62. This one will work: platform_identifiers = { 'home_url': "https://reader.yuzu.com", 'jigsaw_url': "https://jigsaw.yuzu.com", 'total_pages': "sc-gFSQbh ognVW", 'current_page': "InputControlinput-fbzQBk hDtUvs TextFieldInputControl-iza-dmV iISUBf", 'page_loader': "sc-hiwPVj hZlgDU", 'next_page': "IconButtonbutton-bQttMI cSDGGI", } if args.yuzu else { 'home_url': "https://bookshelf.vitalsource.com", 'jigsaw_url': "https://jigsaw.vitalsource.com", 'total_pages': "sc-knKHOI gGldJU", 'current_page': "InputControlinput-fbzQBk hDtUvs TextFieldInputControl-iza-dmV iISUBf", 'page_loader': "sc-AjmGg dDNaMw", 'next_page': "IconButtonbutton-bQttMI gHMmeA sc-oXPCX mwNce", }

Cyberes commented 10 months ago

Oops, must have been a typo in @benjamin-antupit commit.

@itsmalter feel free to submit a PR or you could wait until I fix it.

room-homage commented 10 months ago

I was able to get it running, but it does not return anything after a few minutes. My book's format matches https://bookshelf.vitalsource.com/reader/books/{isbn}/pageid/{page_id} But when I click the info icon, instead of ISBN it shows VBID and the format is PBK. Maybe my file would not work with the code?

itsmalter commented 10 months ago

Oops, must have been a typo in @benjamin-antupit commit.

@itsmalter feel free to submit a PR or you could wait until I fix it.

I will, when I find the time. I am quite new to git and have to do some reading about PR and how to merge :)