diff --git a/youtube-channel-list.py b/youtube-channel-list.py index 8761d9f..a7dbfae 100644 --- a/youtube-channel-list.py +++ b/youtube-channel-list.py @@ -1,3 +1,4 @@ +import collections import sys import yt_dlp @@ -5,5 +6,11 @@ import yt_dlp with yt_dlp.YoutubeDL({'quiet': True}) as ydl: ie = ydl.get_info_extractor('YoutubeTab') for url in sys.argv[1:]: - for entry in ie.extract(url)['entries']: - print(entry['id']) + q = collections.deque() + q.append(ie.extract(url)) + while q: + e = q.popleft() + if 'entries' in e: + q.extend(e['entries']) + elif 'id' in e: + print(e['id'])