Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pearson Reader+: StopIteration at Extracting epub #64

Open
BigB84 opened this issue Jan 16, 2024 · 4 comments
Open

Pearson Reader+: StopIteration at Extracting epub #64

BigB84 opened this issue Jan 16, 2024 · 4 comments

Comments

@BigB84
Copy link

BigB84 commented Jan 16, 2024

Hi!

Thanks so much for this tool!

I encouraged an error while downloading coursebook from Pearson Reader+

Environment Info

  • OS: ArchLinux
  • python: 3.11.6
  • run from venv with requirements installed by pip
  • MuPDF and chromium installed from arch repo
  • This happens in d6e5631 commit latest at the time of writing issue (and at least one previous)
Select a book or a comma-separated list of books: 0
Extracting epub ━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━  31% -:--:--
Traceback (most recent call last):
  File "pdfgrabber/main.py", line 271, in <module>
    main()
  File "pdfgrabber/main.py", line 253, in main
    downloadbook()
  File "pdfgrabber/main.py", line 174, in downloadbook
    pdfpath = utils.downloadbook(service, token, bookid, books[bookid], progressfun)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/utils.py", line 42, in downloadbook
    pdf = service.downloadbook(token, bookid, data, progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/services/prs.py", line 364, in downloadbook
    pdf = downloadrplusepub(data["url"], data["pwd"], progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/services/prs.py", line 321, in downloadrplusepub
    tocitem = next(i for i in tocfile.find("xhtml:body", ns).findall("xhtml:nav", ns) if i.get("{http://www.idpf.org/2007/ops}type") == "toc")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

Could you help me plz?
How should I debug it?

@FelixFrog
Copy link
Owner

I pushed a temporary fix in 1a9c913
Let me know if it works, otherwise I will have to take a deeper dive

@BigB84
Copy link
Author

BigB84 commented Jan 17, 2024

Thanks for quick fix, I pulled changes but unfortunately still:

Traceback (most recent call last):
  File "pdfgrabber/main.py", line 271, in <module>
    main()
  File "pdfgrabber/main.py", line 253, in main
    downloadbook()
  File "pdfgrabber/main.py", line 174, in downloadbook
    pdfpath = utils.downloadbook(service, token, bookid, books[bookid], progressfun)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/utils.py", line 42, in downloadbook
    pdf = service.downloadbook(token, bookid, data, progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/services/prs.py", line 366, in downloadbook
    pdf = downloadrplusepub(data["url"], data["pwd"], progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/services/prs.py", line 326, in downloadrplusepub
    pagelistitem = next(i for i in tocfile.find("xhtml:body", ns).findall("xhtml:nav", ns) if i.get("{http://www.idpf.org/2007/ops}type") == "page-list")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

@BigB84
Copy link
Author

BigB84 commented Jan 19, 2024

With 3f1c98c also

Traceback (most recent call last):
  File "pdfgrabber/main.py", line 271, in <module>
    main()
  File "pdfgrabber/main.py", line 253, in main
    downloadbook()
  File "pdfgrabber/main.py", line 174, in downloadbook
    pdfpath = utils.downloadbook(service, token, bookid, books[bookid], progressfun)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/utils.py", line 42, in downloadbook
    pdf = service.downloadbook(token, bookid, data, progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/services/prs.py", line 431, in downloadbook
    pdf = downloadrplusepub(data["url"], data["pwd"], progress)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pdfgrabber/services/prs.py", line 391, in downloadrplusepub
    pagelistitem = next(i for i in tocfile.find("xhtml:body", ns).findall("xhtml:nav", ns) if i.get("{http://www.idpf.org/2007/ops}type") == "page-list")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

@FelixFrog
Copy link
Owner

You should contact me on telegram as this looks like an error specific to this book.

@jiayx jiayx mentioned this issue Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants