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

playlist_index raises IndexError if there are less items in playlist than given parameter. #14425

Closed
4 tasks done
muraty opened this issue Oct 6, 2017 · 0 comments
Closed
4 tasks done
Labels

Comments

@muraty
Copy link

muraty commented Oct 6, 2017

  • I've verified and I assure that I'm running youtube-dl 2017.10.01
  • Bug report (encountered problems with youtube-dl)
  • Searched the bugtracker for similar issues including closed ones
  • At least skimmed through the README, most notably the FAQ and BUGS sections

I assume that, when I set playlist-items to '1-100', youtube-dl should download first 100 items -if exists of course-. But if there are less items in the playlist than given interval, youtube-dl raises IndexError. I think, there should be a parameter for 'download max 100 items' or playlist-items should behave like this.

Youtube-dl version: 2017.10.01
Playlist URL: https://www.youtube.com/watch?v=qEkj2c1HCJs&list=PLbIzmw8qvgXRPK9ozTWhHfyzFvG8fN-Qz

Python Code:

import youtube_dl

# There are 24 items in the list when this issue is created.
url = 'https://www.youtube.com/watch?v=qEkj2c1HCJs&list=PLbIzmw8qvgXRPK9ozTWhHfyzFvG8fN-Qz'

ydl = youtube_dl.YoutubeDL({'format': 'best',
                            'noplaylist': False,
                            'skip_download': False,
                            'playlist_items': '1-100',
                            'ignoreerros': True})
ydl.download([url])

Error:

[youtube:playlist] Downloading playlist PLbIzmw8qvgXRPK9ozTWhHfyzFvG8fN-Qz - add --no-playlist to just download video qEkj2c1HCJs
[youtube:playlist] PLbIzmw8qvgXRPK9ozTWhHfyzFvG8fN-Qz: Downloading webpage
[download] Downloading playlist: Amansız Övücüler
Traceback (most recent call last):
  File "<stdin>", line 11, in <module>
  File "/home/ubuntu/.virtualenvs/putio/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 1974, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/home/ubuntu/.virtualenvs/putio/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 794, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/ubuntu/.virtualenvs/putio/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 943, in process_ie_result
    entries = [entry_list[i - 1] for i in playlistitems]
  File "/home/ubuntu/.virtualenvs/putio/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 943, in <listcomp>
    entries = [entry_list[i - 1] for i in playlistitems]
IndexError: list index out of range
list index out of range

Is there any parameter for this issue? If not so, you can assign this issue to me.

@dstftw dstftw added the bug label Oct 6, 2017
@dstftw dstftw closed this as completed in 7e85e87 Oct 6, 2017
dstftw added a commit that referenced this issue Oct 6, 2017
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