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

Youtube-dl crash when trying to get best format. #10233

Closed
skorokithakis opened this issue Aug 5, 2016 · 1 comment
Closed

Youtube-dl crash when trying to get best format. #10233

skorokithakis opened this issue Aug 5, 2016 · 1 comment

Comments

@skorokithakis
Copy link

@skorokithakis skorokithakis commented Aug 5, 2016

The following code crashes with the latest youtube-dl version (relevant downstream issue):

ydl = youtube_dl.YoutubeDL({})
info = ydl.extract_info(video_url, download=False)
format_selector = ydl.build_format_selector("best")
list(format_selector(info["formats"]))

It worked up until 2016.07.13, and now it breaks:

----> 1 list(format_selector(info["formats"]))

youtube_dl/YoutubeDL.pyc in selector_function(ctx)
   1055                 def selector_function(ctx):
   1056                     for f in fs:
-> 1057                         for format in f(ctx):
   1058                             yield format
   1059                 return selector_function

youtube_dl/YoutubeDL.pyc in selector_function(ctx)
   1073 
   1074                 def selector_function(ctx):
-> 1075                     formats = list(ctx['formats'])
   1076                     if not formats:
   1077                         return

TypeError: list indices must be integers, not unicode
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 5, 2016

list(format_selector(info["formats"]))

is incorrect. Use:

list(format_selector(info))
@yan12125 yan12125 closed this Aug 5, 2016
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
2 participants
You can’t perform that action at this time.