diff options
author | pukkandan <pukkandan@gmail.com> | 2020-11-27 00:27:53 +0530 |
---|---|---|
committer | pukkandan <pukkandan@gmail.com> | 2020-11-27 00:27:53 +0530 |
commit | f0c532a430a07f7965b68b22f9ceb90542b848f6 (patch) | |
tree | 75d2f64c89876c6b1d75a698f4591964a0b80fc7 | |
parent | a62cf342988d80148fcff608d3ff828238e9573b (diff) | |
download | hypervideo-pre-f0c532a430a07f7965b68b22f9ceb90542b848f6.tar.lz hypervideo-pre-f0c532a430a07f7965b68b22f9ceb90542b848f6.tar.xz hypervideo-pre-f0c532a430a07f7965b68b22f9ceb90542b848f6.zip |
Fix some improper Youtube URLs
Eg: https://www.youtube.com/watch?list=UUXIkr0SRTnZO4_QpZozvCCA
-rw-r--r-- | youtube_dlc/extractor/youtube.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/youtube_dlc/extractor/youtube.py b/youtube_dlc/extractor/youtube.py index 72bc5a0da..3570bce71 100644 --- a/youtube_dlc/extractor/youtube.py +++ b/youtube_dlc/extractor/youtube.py @@ -3256,11 +3256,20 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor): qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query) video_id = qs.get('v', [None])[0] playlist_id = qs.get('list', [None])[0] + + if is_home.group('not_channel').startswith('watch') and not video_id: + if playlist_id: + self._downloader.report_warning('%s is not a valid Youtube URL. Trying to download playlist %s' % (url, playlist_id)) + url = 'https://www.youtube.com/playlist?list=%s' % playlist_id + # return self.url_result(playlist_id, ie=YoutubePlaylistIE.ie_key()) + else: + raise ExtractorError('Unable to recognize tab page') if video_id and playlist_id: if self._downloader.params.get('noplaylist'): self.to_screen('Downloading just video %s because of --no-playlist' % video_id) return self.url_result(video_id, ie=YoutubeIE.ie_key(), video_id=video_id) self.to_screen('Downloading playlist %s - add --no-playlist to just download video %s' % (playlist_id, video_id)) + webpage = self._download_webpage(url, item_id) identity_token = self._search_regex( r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, |