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

[mangahere] page-reverse results in TypeError: 'generator' object is not reversible #2795

Closed
kattjevfel opened this issue Jul 30, 2022 · 4 comments
Labels

Comments

@kattjevfel
Copy link
Contributor

When trying to use extractor.mangahere.page-reverse=true, gallery-dl throws an error for each page instead, like this:

[gallery-dl][debug] Version 1.23.0-dev
[gallery-dl][debug] Python 3.10.5 - Linux-5.18.14-zen1-1-zen-x86_64-with-glibc2.35
[gallery-dl][debug] requests 2.27.1 - urllib3 1.26.9
[gallery-dl][debug] Starting DownloadJob for 'https://www.mangahere.cc/manga/an_evil_dragon_that_was_sealed_away_for_300_years_became_my_friend/'
[mangahere][debug] Using MangahereMangaExtractor for 'https://www.mangahere.cc/manga/an_evil_dragon_that_was_sealed_away_for_300_years_became_my_friend/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.mangahere.cc:443
[urllib3.connectionpool][debug] https://www.mangahere.cc:443 "GET /manga/an_evil_dragon_that_was_sealed_away_for_300_years_became_my_friend/ HTTP/1.1" 200 None
[mangahere][debug] Using MangahereChapterExtractor for 'https://www.mangahere.cc/manga/an_evil_dragon_that_was_sealed_away_for_300_years_became_my_friend/c001/1.html'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): m.mangahere.cc:443
[urllib3.connectionpool][debug] https://m.mangahere.cc:443 "GET /manga/an_evil_dragon_that_was_sealed_away_for_300_years_became_my_friend/c001/1.html HTTP/1.1" 200 None
[urllib3.connectionpool][debug] https://www.mangahere.cc:443 "GET /manga/an_evil_dragon_that_was_sealed_away_for_300_years_became_my_friend/c001/ HTTP/1.1" 200 None
[mangahere][error] An unexpected error occurred: TypeError - 'generator' object is not reversible. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[mangahere][debug] 
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/gallery_dl/job.py", line 77, in run
    for msg in extractor:
  File "/usr/lib/python3.10/site-packages/gallery_dl/extractor/common.py", line 520, in items
    images = util.enumerate_reversed(imgs, 1, data["count"])
  File "/usr/lib/python3.10/site-packages/gallery_dl/util.py", line 169, in enumerate_reversed
    reversed(iterable),
TypeError: 'generator' object is not reversible

(cut after first page)

Can be reproduced with gallery-dl --verbose --ignore-config --option extractor.mangahere.page-reverse=true https://www.mangahere.cc/manga/an_evil_dragon_that_was_sealed_away_for_300_years_became_my_friend/

@mikf mikf added the bug label Jul 31, 2022
@mikf
Copy link
Owner

mikf commented Jul 31, 2022

page-reverse currently only works for chapter extractors that return their results in one big list.

I can make it work for extractors that have to go page-by-page like mangahere, but that would mean the program sits around for several seconds/minutes doing "nothing" until it collected all pages.

Would that be OK? Because I really do not want to write code that actually goes through all website pages in reverse order.

@kattjevfel
Copy link
Contributor Author

I use this feature so I can use --abort, but also not have it mess up with partially downloaded mangas. So having that solution versus none, I'll gladly take it.

Besides, I personally mainly use this application via a cronjob that runs as I sleep, and I can assure you I sleep for more than several seconds/minutes.

@mikf
Copy link
Owner

mikf commented Aug 3, 2022

Fixed in commit dd3a6a9, but you might want to set a sleep-request value for mangahere. Otherwise gallery-dl will bombard the site with HTTP requests in a very unnatural way and might get you blocked.

@kattjevfel
Copy link
Contributor Author

Seems to work for me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants