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

Culinary Chronicles Vol 1 Part 2 download failure #7

Closed
justdave opened this issue Feb 23, 2021 · 7 comments
Closed

Culinary Chronicles Vol 1 Part 2 download failure #7

justdave opened this issue Feb 23, 2021 · 7 comments

Comments

@justdave
Copy link

$ jncep epub --byvolume --parts 1:2 --email "$EMAIL" --password "$PASSWORD" https://j-novel.club/titles/culinary-chronicles-of-the-court-flower
Fetching part 'Culinary Chronicles of the Court Flower: Volume 1 Part 2'...
Fetching images found in part content...
Image 1...
Fetching cover image...
*** An unrecoverable error occured ***
Document is empty

I'm guessing this is a missing cover image on part 2? But I can't figure out how to get enough debugging info out of it to make sure before I report it to JNC (and since their web reader works I need proof the API is busted to report it to them :-) )

@gvellut
Copy link
Owner

gvellut commented Feb 24, 2021

Thank you for reporting the issue.

I have just tried using :

jncep epub https://j-novel.club/titles/culinary-chronicles-of-the-court-flower 

And it is downloading fine. Maybe they fixed the issue?

There is a way to get more info for debugging but currently a file has to be edited manually: Wherever the jncep Python package is installed, the file jncep/__init__.py can be edited and there is a DEBUG variable that can be changed to True. Then some additional info should be displayed.

@justdave
Copy link
Author

this is from a jncep update (it's not updating the tracking data, so it tries to fetch it every time) with debug enabled:

Fetching metadata for 'culinary-chronicles-of-the-court-flower'...
Fetching part 'Culinary Chronicles of the Court Flower: Volume 1 Part 1'...
Fetching images found in part content...
Image 1...
Image 2...
Fetching part 'Culinary Chronicles of the Court Flower: Volume 1 Part 2'...
Fetching images found in part content...
Image 1...
Fetching cover image...
An error occured while updating the series:
Document is empty
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/jncep/jncep.py", line 360, in update_tracked
    is_updated = _create_updated_epub(
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/jncep/jncep.py", line 460, in _create_updated_epub
    _create_epub_with_requested_parts(
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/jncep/jncep.py", line 520, in _create_epub_with_requested_parts
    core.create_epub(
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/jncep/core.py", line 125, in create_epub
    create_epub_file(
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/jncep/core.py", line 362, in create_epub_file
    epub.write_epub(output_filepath, book, {})
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/epub.py", line 1717, in write_epub
    epub.write()
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/epub.py", line 1364, in write
    self._write_items()
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/epub.py", line 1351, in _write_items
    self.out.writestr('%s/%s' % (self.book.FOLDER_NAME, item.file_name), self._get_nav(item))
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/epub.py", line 1207, in _get_nav
    inserted_pages = get_pages_for_items([item for item in self.book.get_items_of_type(ebooklib.ITEM_DOCUMENT) \
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/utils.py", line 118, in get_pages_for_items
    pages_from_docs = [get_pages(item) for item in items]
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/utils.py", line 118, in <listcomp>
    pages_from_docs = [get_pages(item) for item in items]
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/utils.py", line 95, in get_pages
    body = parse_html_string(item.get_body_content())
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/ebooklib/utils.py", line 47, in parse_html_string
    html_tree = html.document_fromstring(s, parser=utf8_parser)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/site-packages/lxml/html/__init__.py", line 763, in document_fromstring
    raise etree.ParserError(
lxml.etree.ParserError: Document is empty

@gvellut
Copy link
Owner

gvellut commented Feb 24, 2021

Can you try with the epub command to check if you get the same issue ?

jncep epub https://j-novel.club/titles/culinary-chronicles-of-the-court-flower -s 1.2

I don't get the error you get even with update.

@justdave
Copy link
Author

still getting the same error with that. Only thing I can think of is if I have a bad version of lxml or something? (since that's where it's crashing) but if that were the case, wouldn't it break everything and not just that one specific part? I've got lxml 4.5.1. If I try to pip install a newer one it complains that I'm missing libxml2 or libxslt. I'm running this on android, so not sure I can install those. (but then again wondering why it works with every other part on every other volume if that were a problem)

@gvellut
Copy link
Owner

gvellut commented Feb 24, 2021

Ye this is weird. I checked the HTML for the part but it seems fine.

I am going to look further into it.

@gvellut
Copy link
Owner

gvellut commented Feb 24, 2021

I can confirm it is an issue with the interaction of lxml and Python of PyDroid (something to do with a lack of support for the character encoding used internally by Python...). The part contained a 4-byte character (that appears to be a black square) so this is why there was no issue with other parts.

I have added an explicit encoding of the content before generating the EPUB and it seems to work fine with PyDroid.

You can upgrade to version jncep version 0.20.

@justdave
Copy link
Author

That works! Awesome, I wasn''t expecting such an easy fix :)

@gvellut gvellut closed this as completed Feb 27, 2021
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