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

[deviantart] Metadata extractor breaks on certain posts #414

Closed
kargaroc opened this issue Sep 8, 2019 · 2 comments
Closed

[deviantart] Metadata extractor breaks on certain posts #414

kargaroc opened this issue Sep 8, 2019 · 2 comments

Comments

@kargaroc
Copy link

kargaroc commented Sep 8, 2019

Here's my config.json:

{
 "extractor": {
  "deviantart": {
   "client-id": "<id>",
   "client-secret": "<secret>",
   "metadata": true,
   "postprocessors": [{
    "name": "metadata",
    "mode": "custom",
    "extension": "htm",
    "format": "<b>{title}<br />{date}<br />{category_path}</b><hr>{description}<hr>{url}<br />{tags}"
   }]
  }
 }
}

Try to download the following:
https://www.deviantart.com/aeonrin
with these settings and it will break

see

[gallery-dl][debug] Version 1.10.4
[gallery-dl][debug] Python 3.7.4 - Linux-5.2.9-arch1-1-ARCH-x86_64-with-arch
[gallery-dl][debug] requests 2.22.0 - urllib3 1.25.3
[gallery-dl][debug] Starting DownloadJob for 'https://www.deviantart.com/aeonrin/gallery/?catpath=/'
[gallery-dl][debug] Updating urllib3 ciphers
[deviantart][debug] Using DeviantartGalleryExtractor for 'https://www.deviantart.com/aeonrin/gallery/?catpath=/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.deviantart.com:443
[urllib3.connectionpool][debug] https://www.deviantart.com:443 "GET /api/v1/oauth2/user/profile/aeonrin HTTP/1.1" 200 1514
[urllib3.connectionpool][debug] https://www.deviantart.com:443 "GET /api/v1/oauth2/gallery/all?username=aeonrin&offset=0&limit=24&mature_content=true HTTP/1.1" 200 469
[urllib3.connectionpool][debug] https://www.deviantart.com:443 "GET /api/v1/oauth2/deviation/metadata?deviationids%5B0%5D=1F1C90EC-C96C-0C32-B9D8-58470C68E2E8&mature_content=true HTTP/1.1" 200 296
[deviantart][debug] Active postprocessor modules: [MetadataPP]
[urllib3.connectionpool][debug] https://www.deviantart.com:443 "GET /api/v1/oauth2/deviation/content?deviationid=1F1C90EC-C96C-0C32-B9D8-58470C68E2E8 HTTP/1.1" 200 1052
./gallery-dl/deviantart/aeonrin/deviantart_555918906_..htm
[urllib3.connectionpool][debug] https://www.deviantart.com:443 "GET /api/v1/oauth2/gallery/all?username=aeonrin&offset=24&limit=24&mature_content=true HTTP/1.1" 200 70
[urllib3.connectionpool][debug] https://www.deviantart.com:443 "GET /api/v1/oauth2/deviation/metadata?mature_content=true HTTP/1.1" 400 124
[deviantart][debug] {"error":"invalid_request","error_description":"Request field validation failed.","error_details":{"deviationids":"deviationids is required"},"status":"error"}
[deviantart][error] API responded with 400 Bad Request
[deviantart][error] An unexpected error occurred: KeyError - 'metadata'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[deviantart][debug] 
Traceback (most recent call last):
  File "gallery-dl-master/gallery_dl/job.py", line 47, in run
    for msg in self.extractor:
  File "gallery-dl-master/gallery_dl/extractor/deviantart.py", line 72, in items
    for deviation in self.deviations():
  File "gallery-dl-master/gallery_dl/extractor/deviantart.py", line 986, in _pagination
    self._metadata(data["results"])
  File "gallery-dl-master/gallery_dl/extractor/deviantart.py", line 1003, in _metadata
    deviations, self.deviation_metadata(deviations)):
  File "gallery-dl-master/gallery_dl/extractor/deviantart.py", line 881, in deviation_metadata
    return self._call(endpoint, params)["metadata"]
KeyError: 'metadata'```
@mikf
Copy link
Owner

mikf commented Sep 8, 2019

Most of this user's deviations are private. Run gallery-dl oauth:deviantart to get a refresh-token so gallery-dl can see and download them. This will also "fix" this issue, but I might as well make sure this can't happen again and also add log message about private deviations.

@github-userx
Copy link

github-userx commented Sep 8, 2019 via email

mikf added a commit that referenced this issue Sep 11, 2019
- don't try to call '/deviation/metadata' with an empty list of
  deviation ids
- print a warning when detecting private deviations without having
  a 'refresh-token'
@mikf mikf closed this as completed Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants