FelixFrog / pdfgrabber

Download PDF books from bSmart, Pearson, Oxford, and many more!
GNU Affero General Public License v3.0
114 stars 17 forks source link

CNG KeyError: 'logicalPageNumber' #84

Closed phantanvietpk closed 2 months ago

phantanvietpk commented 6 months ago

Hi!

Thanks so much for this tool!

I encouraged an error while downloading coursebook from Cengage Read

Extracting zip ━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━  46% 0:00:12
Traceback (most recent call last):
  File "/Users/Downloads/pdfgrabber/main.py", line 271, in <module>
    main()
  File "/Users/Downloads/pdfgrabber/main.py", line 253, in main
    downloadbook()
  File "/Users/Downloads/pdfgrabber/main.py", line 174, in downloadbook
    pdfpath = utils.downloadbook(service, token, bookid, books[bookid], progressfun)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Downloads/pdfgrabber/utils.py", line 42, in downloadbook
    pdf = service.downloadbook(token, bookid, data, progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Downloads/pdfgrabber/services/cng.py", line 246, in downloadbook
    pdf = downloadhtml5(accesstoken, data, progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Downloads/pdfgrabber/services/cng.py", line 214, in downloadhtml5
    totpages, toc, totnum = linearize(structure["book"], 1, 1)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/des/Downloads/pdfgrabber/services/cng.py", line 190, in linearize
    if i["title"] != i["logicalPageNumber"]:
                     ~^^^^^^^^^^^^^^^^^^^^^
KeyError: 'logicalPageNumber'
pitcany commented 4 months ago

Same here.