Fix out of bound exception

There is an out of bound exception when iterating over info['entries'][j]  in get_playlist_info()
The lenght of info['entries'] has to be taken into account in the loop boundaries
This commit is contained in:
Rackoono 2019-03-29 03:01:26 +01:00 committed by GitHub
parent 59e8d0d978
commit ed3ace0f33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ def get_playlist_info(url, start_index=1, user=""):
try:
info = ydl.extract_info(url, download=False)
playlist_title = info['title']
for j in range(start_index, start_index + var.config.getint('bot', 'max_track_playlist')):
for j in range(start_index, min( len(info['entries']), start_index + var.config.getint('bot', 'max_track_playlist') ) ):
music = {'type': 'url',
'title': info['entries'][j]['title'],
'url': "https://www.youtube.com/watch?v=" + info['entries'][j]['url'],