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

[danbooru][error] "KeyError: 3456687" when downloading posts with extractor.danbooru.metadata=true #4002

Closed
HexHummingbird opened this issue May 3, 2023 · 3 comments
Labels

Comments

@HexHummingbird
Copy link

Hello.
I get an error when I'm trying to download favorite images of a user from danbooru with metadata option set to true.

gallery-dl.exe --verbose -s -o extractor.danbooru.metadata=true 'https://danbooru.donmai.us/posts?tags=ordfav%3Akiyah123'
[gallery-dl][debug] Version 1.25.3 - Executable
[gallery-dl][debug] Python 3.8.10 - Windows-10-10.0.19045-SP0
[gallery-dl][debug] requests 2.28.2 - urllib3 1.26.15
[gallery-dl][debug] Configuration Files []
[gallery-dl][debug] Starting SimulationJob for 'https://danbooru.donmai.us/posts?tags=ordfav%3Akiyah123'
[danbooru][debug] Using DanbooruTagExtractor for 'https://danbooru.donmai.us/posts?tags=ordfav%3Akiyah123'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): danbooru.donmai.us:443
[urllib3.connectionpool][debug] https://danbooru.donmai.us:443 "GET /posts.json?tags=ordfav%3Akiyah123&limit=200 HTTP/1.1" 200 None
[danbooru][debug] Sleeping 1.00 seconds (request)
[urllib3.connectionpool][debug] https://danbooru.donmai.us:443 "GET /posts.json?tags=ordfav%3Akiyah123&limit=200&page=b6223003&only=artist_commentary%2Cchildren%2Cnotes%2Cparent%2Cuploader%2Cid HTTP/1.1" 200 None
[danbooru][error] An unexpected error occurred: KeyError - 3456687. Please run gallery-dl again with the --verbose flag, copy its output and 
report this issue on https://github.com/mikf/gallery-dl/issues .
[danbooru][debug] 
Traceback (most recent call last):
  File "gallery_dl\job.pyc", line 96, in run
  File "gallery_dl\extractor\danbooru.pyc", line 61, in items
  File "gallery_dl\extractor\danbooru.pyc", line 114, in _pagination
KeyError: 3456687

Above command works correctly without metadata option:

gallery-dl.exe --verbose -s 'https://danbooru.donmai.us/posts?tags=ordfav%3Akiyah123'
[gallery-dl][debug] Version 1.25.3 - Executable
[gallery-dl][debug] Python 3.8.10 - Windows-10-10.0.19045-SP0
[gallery-dl][debug] requests 2.28.2 - urllib3 1.26.15
[gallery-dl][debug] Configuration Files []
[gallery-dl][debug] Starting SimulationJob for 'https://danbooru.donmai.us/posts?tags=ordfav%3Akiyah123'
[danbooru][debug] Using DanbooruTagExtractor for 'https://danbooru.donmai.us/posts?tags=ordfav%3Akiyah123'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): danbooru.donmai.us:443
[urllib3.connectionpool][debug] https://danbooru.donmai.us:443 "GET /posts.json?tags=ordfav%3Akiyah123&limit=200 HTTP/1.1" 200 None
# danbooru_6223002_dcae6a56a31897e056cb9e9dec329cc0.jpg
...
@mikf mikf added the site:bug label May 3, 2023
@mikf
Copy link
Owner

mikf commented May 3, 2023

The "improvements" from 75666cf do not work all that well with non-standard sorting orders like ordfav:, it seems.

Try gallery-dl version 1.25.1 where this change wasn't included yet, or do not order the posts by time favorited.

@mikf
Copy link
Owner

mikf commented May 4, 2023

Turns out that this problem is not confined to only metadata; the current pagination logic does not return the correct/full results for any post order other than the default order:id_desc.

mikf added a commit that referenced this issue May 14, 2023
Search for direct post IDs instead of trying to
replicate the same results as the initial request.
mikf added a commit that referenced this issue May 14, 2023
- only use 'b<ID>' when no other order is specified
- support 'a<ID>' when  using 'order:id' as tag
@mikf
Copy link
Owner

mikf commented May 14, 2023

Fixed in fd0e1ff and 494acab.

Using -o metadata=true will no longer result in a crash when using ordfav: or any other order: tag, and it will actually download posts in the correct order instead of always implicitly using order:id_desc.

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