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:
parent
59e8d0d978
commit
ed3ace0f33
@ -11,7 +11,7 @@ def get_playlist_info(url, start_index=1, user=""):
|
|||||||
try:
|
try:
|
||||||
info = ydl.extract_info(url, download=False)
|
info = ydl.extract_info(url, download=False)
|
||||||
playlist_title = info['title']
|
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',
|
music = {'type': 'url',
|
||||||
'title': info['entries'][j]['title'],
|
'title': info['entries'][j]['title'],
|
||||||
'url': "https://www.youtube.com/watch?v=" + info['entries'][j]['url'],
|
'url': "https://www.youtube.com/watch?v=" + info['entries'][j]['url'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user