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

instagram - patch to deal with images with wrong "video" type #12284

Closed
trson opened this issue Feb 26, 2017 · 2 comments
Closed

instagram - patch to deal with images with wrong "video" type #12284

trson opened this issue Feb 26, 2017 · 2 comments

Comments

@trson
Copy link

@trson trson commented Feb 26, 2017

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.02.24.1. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2017.02.24.1

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Description of your issue, suggested solution and other information

Sometimes an instagram profile contains an image which is wrongly described in the json data as having type: video, instead of type: image. (On the website these are displayed as images with a little square icon in the top-right corner, dunno what that means)

When youtube-dl runs into one of these images, it aborts with the following error:

ERROR: An extractor error has occurred. (caused by KeyError('videos',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/common.py", line 427, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python3.5/dist-packages/youtube_dl/extractor/instagram.py", line 264, in _real_extract
    } for k, v in it['videos'].items()]

KeyError: 'videos'

This happens because the "fake" video item is in fact an image, so it doesn't have the videos json element (which describes the available video formats and urls for the item).

For a quick fix: add a check for existence of the videos element, see the attached patch for /extractor/instagram.py

(This works for me, I'm not sure if other changes are needed/better, please review).

instagram.py.txt

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 27, 2017

  1. Provide example URL.
  2. If you want this to be merged you have to add a test and open a pull request.
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented May 12, 2017

Closing as no response for a long time.

@yan12125 yan12125 closed this May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.