support range in youtube

This commit is contained in:
Toby She 2021-04-20 20:35:27 -04:00
parent e1af6611b2
commit 2dc5f54d9e

View File

@ -172,6 +172,8 @@ class YouTube(VideoExtractor):
self.title = re.search(r'<meta name="title" content="([^"]+)"', video_page).group(1) self.title = re.search(r'<meta name="title" content="([^"]+)"', video_page).group(1)
self.p_playlist() self.p_playlist()
for index, video in enumerate(videos, 1): for index, video in enumerate(videos, 1):
if index not in kwargs['args'].range:
continue
vid = video['playlistVideoRenderer']['videoId'] vid = video['playlistVideoRenderer']['videoId']
try: try:
self.__class__().download_by_url(self.__class__.get_url_from_vid(vid), index=index, **kwargs) self.__class__().download_by_url(self.__class__.get_url_from_vid(vid), index=index, **kwargs)