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

[Bug][Gfycat] "malformed" gfycat json throws KeyError - gfyName #902

Closed
shinji257 opened this issue Jul 20, 2020 · 1 comment
Closed

[Bug][Gfycat] "malformed" gfycat json throws KeyError - gfyName #902

shinji257 opened this issue Jul 20, 2020 · 1 comment

Comments

@shinji257
Copy link
Contributor

shinji257 commented Jul 20, 2020

This one ended up being odd. It may even just be a one off but I thought to at least let you know. Please be aware this particular gfycat doesn't exist (as it turns out) so no lost data for me but I don't know if this means that some error checking should be handled on the script.

shinji@hermes:~/tmp$ gallery-dl --verbose https://gfycat.com/illexcitablehairstreak
[gallery-dl][debug] Version 1.14.3
[gallery-dl][debug] Python 3.8.0 - Linux-5.4.41-1-pve-x86_64-with-glibc2.29
[gallery-dl][debug] requests 2.24.0 - urllib3 1.25.9
[gallery-dl][debug] Starting DownloadJob for 'https://gfycat.com/illexcitablehairstreak'
[gfycat][debug] Using GfycatImageExtractor for 'https://gfycat.com/illexcitablehairstreak'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): api.gfycat.com:443
[urllib3.connectionpool][debug] https://api.gfycat.com:443 "GET /v1/gfycats/illexcitablehairstreak HTTP/1.1" 200 318
[gfycat][debug] Using download archive './gallery-dl/archive-gfycat.sqlite3'
[gfycat][error] An unexpected error occurred: KeyError - 'gfyName'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[gfycat][debug]
Traceback (most recent call last):
  File "/home/shinji/.local/lib/python3.8/site-packages/gallery_dl/job.py", line 62, in run
    self.dispatch(msg)
  File "/home/shinji/.local/lib/python3.8/site-packages/gallery_dl/job.py", line 96, in dispatch
    self.handle_url(url, kwds)
  File "/home/shinji/.local/lib/python3.8/site-packages/gallery_dl/job.py", line 224, in handle_url
    if pathfmt.exists(archive):
  File "/home/shinji/.local/lib/python3.8/site-packages/gallery_dl/util.py", line 774, in exists
    if archive and self.kwdict in archive:
  File "/home/shinji/.local/lib/python3.8/site-packages/gallery_dl/util.py", line 948, in __contains__
    key = kwdict["_archive_key"] = self.keygen(kwdict)
KeyError: 'gfyName'

For those wanting to see a comparison here is a few:
A good api response: https://api.gfycat.com/v1/gfycats/harmoniousgentlecivet
This api response: https://api.gfycat.com/v1/gfycats/illexcitablehairstreak
A normal 404 response (I just removed the k): https://api.gfycat.com/v1/gfycats/illexcitablehairstrea

The values I find strange are nsfw and gatekeeper are 0 (or 1) for the good responses. On the bad one above it is 3. wtf does 3 mean? Also gfyNumber is 0 on the bad one. Maybe just treat gfyNumber == 0 == bad?

@mikf mikf closed this as completed in baf5d0e Jul 24, 2020
@mikf
Copy link
Owner

mikf commented Jul 24, 2020

wtf does 3 mean?

"3" means "Possibly Offensive" according to the API docs:

Indicates if content is “safe for work” or not. 0 == Clean, 1 == Adult, 3 == Possibly Offensive

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