|
|
@ -72,7 +72,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
|
|
|
# If True it will raise an error if no login info is provided
|
|
|
|
# If True it will raise an error if no login info is provided
|
|
|
|
_LOGIN_REQUIRED = False
|
|
|
|
_LOGIN_REQUIRED = False
|
|
|
|
|
|
|
|
|
|
|
|
_PLAYLIST_ID_RE = r'(?:(?:PL|LL|EC|UU|FL|RD|UL|TL|PU|OLAK5uy_)[0-9A-Za-z-_]{10,}|RDMM|LL|WL)'
|
|
|
|
_PLAYLIST_ID_RE = r'(?:(?:PL|LL|EC|UU|FL|RD|UL|TL|PU|OLAK5uy_)[0-9A-Za-z-_]{10,})'
|
|
|
|
|
|
|
|
|
|
|
|
_YOUTUBE_CLIENT_HEADERS = {
|
|
|
|
_YOUTUBE_CLIENT_HEADERS = {
|
|
|
|
'x-youtube-client-name': '1',
|
|
|
|
'x-youtube-client-name': '1',
|
|
|
@ -2532,7 +2532,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|
|
|
|
|
|
|
|
|
|
|
class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
|
|
|
class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
|
|
|
IE_DESC = 'YouTube.com tab'
|
|
|
|
IE_DESC = 'YouTube.com tab'
|
|
|
|
# (?x)^ will cause warning in LiveIE. So I cant split this into multiple lines using '''
|
|
|
|
|
|
|
|
_VALID_URL = (
|
|
|
|
_VALID_URL = (
|
|
|
|
r'https?://(?:\w+\.)?(?:youtube(?:kids)?\.com|invidio\.us)/'
|
|
|
|
r'https?://(?:\w+\.)?(?:youtube(?:kids)?\.com|invidio\.us)/'
|
|
|
|
r'(?:(?!(%s)([/#?]|$))|'
|
|
|
|
r'(?:(?!(%s)([/#?]|$))|'
|
|
|
@ -2778,11 +2777,11 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
|
|
|
'url': 'https://www.youtube.com/c/CommanderVideoHq/live',
|
|
|
|
'url': 'https://www.youtube.com/c/CommanderVideoHq/live',
|
|
|
|
'only_matching': True,
|
|
|
|
'only_matching': True,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
# TODO
|
|
|
|
# TODO
|
|
|
|
# {
|
|
|
|
# {
|
|
|
|
# 'url': 'https://www.youtube.com/TheYoungTurks/live',
|
|
|
|
# 'url': 'https://www.youtube.com/TheYoungTurks/live',
|
|
|
|
# 'only_matching': True,
|
|
|
|
# 'only_matching': True,
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
def _extract_channel_id(self, webpage):
|
|
|
|
def _extract_channel_id(self, webpage):
|
|
|
@ -3461,9 +3460,8 @@ class YoutubeSearchDateIE(YoutubeSearchIE):
|
|
|
|
class YoutubeSearchURLIE(InfoExtractor):
|
|
|
|
class YoutubeSearchURLIE(InfoExtractor):
|
|
|
|
IE_DESC = 'YouTube.com search URLs'
|
|
|
|
IE_DESC = 'YouTube.com search URLs'
|
|
|
|
IE_NAME = 'youtube:search_url'
|
|
|
|
IE_NAME = 'youtube:search_url'
|
|
|
|
_PARAM_REGEX = r''
|
|
|
|
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?youtube\.com/results/?(?:\?|\?[^#]*?&)(?:sp=(?P<param1>[^&#]+)&(?:[^#]*&)?)?(?:q|search_query)=(?P<query>[^#&]+)(?:[^#]*?&sp=(?P<param2>[^#&]+))?'
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?youtube\.com/results/?(?:\?|\?[^#]*?&)(?:sp=(?P<param1>[^&#]+)&(?:[^#]*&)?)?(?:q|search_query)=(?P<query>[^#&]+)(?:[^#]*?&sp=(?P<param2>[^#&]+))?'
|
|
|
|
_MAX_RESULTS = 100
|
|
|
|
# _MAX_RESULTS = 100
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video',
|
|
|
|
'url': 'https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video',
|
|
|
|
'playlist_mincount': 5,
|
|
|
|
'playlist_mincount': 5,
|
|
|
@ -3480,9 +3478,9 @@ class YoutubeSearchURLIE(InfoExtractor):
|
|
|
|
query = compat_urllib_parse_unquote_plus(mobj.group('query'))
|
|
|
|
query = compat_urllib_parse_unquote_plus(mobj.group('query'))
|
|
|
|
IE = YoutubeSearchIE(self._downloader)
|
|
|
|
IE = YoutubeSearchIE(self._downloader)
|
|
|
|
IE._SEARCH_PARAMS = mobj.group('param1') or mobj.group('param2')
|
|
|
|
IE._SEARCH_PARAMS = mobj.group('param1') or mobj.group('param2')
|
|
|
|
self._downloader.to_screen(IE._SEARCH_PARAMS)
|
|
|
|
if hasattr(self, '_MAX_RESULTS'):
|
|
|
|
IE._MAX_RESULTS = self._MAX_RESULTS
|
|
|
|
IE._MAX_RESULTS = self._MAX_RESULTS
|
|
|
|
return IE._get_n_results(query, self._MAX_RESULTS)
|
|
|
|
return IE._get_n_results(query, IE._MAX_RESULTS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YoutubeFeedsInfoExtractor(YoutubeTabIE):
|
|
|
|
class YoutubeFeedsInfoExtractor(YoutubeTabIE):
|
|
|
@ -3491,9 +3489,8 @@ class YoutubeFeedsInfoExtractor(YoutubeTabIE):
|
|
|
|
Subclasses must define the _FEED_NAME and _PLAYLIST_TITLE properties.
|
|
|
|
Subclasses must define the _FEED_NAME and _PLAYLIST_TITLE properties.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
_LOGIN_REQUIRED = True
|
|
|
|
_LOGIN_REQUIRED = True
|
|
|
|
_TESTS = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# _MAX_PAGES = 5
|
|
|
|
# _MAX_PAGES = 5
|
|
|
|
|
|
|
|
_TESTS = []
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def IE_NAME(self):
|
|
|
|
def IE_NAME(self):
|
|
|
@ -3531,10 +3528,10 @@ class YoutubeFeedsInfoExtractor(YoutubeTabIE):
|
|
|
|
raise ExtractorError('Unable to recognize feed page')
|
|
|
|
raise ExtractorError('Unable to recognize feed page')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YoutubeWatchLaterIE(YoutubeFeedsInfoExtractor):
|
|
|
|
class YoutubeWatchLaterIE(InfoExtractor):
|
|
|
|
|
|
|
|
IE_NAME = 'youtube:watchlater'
|
|
|
|
IE_DESC = 'Youtube watch later list, ":ytwatchlater" or "WL" for short (requires authentication)'
|
|
|
|
IE_DESC = 'Youtube watch later list, ":ytwatchlater" or "WL" for short (requires authentication)'
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?youtube\.com/feed/watch_later|:ytwatchlater'
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?youtube\.com/feed/watch_later|:ytwatchlater|WL'
|
|
|
|
_FEED_NAME = 'watchlater'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://www.youtube.com/feed/watch_later',
|
|
|
|
'url': 'https://www.youtube.com/feed/watch_later',
|
|
|
@ -3545,13 +3542,14 @@ class YoutubeWatchLaterIE(YoutubeFeedsInfoExtractor):
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
return self.url_result('WL', ie=YoutubePlaylistIE.ie_key())
|
|
|
|
return self.url_result(
|
|
|
|
|
|
|
|
'https://www.youtube.com/playlist?list=WL', ie=YoutubeTabIE.ie_key())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YoutubeFavouritesIE(YoutubeFeedsInfoExtractor):
|
|
|
|
class YoutubeFavouritesIE(InfoExtractor):
|
|
|
|
|
|
|
|
IE_NAME = 'youtube:favourites'
|
|
|
|
IE_DESC = 'YouTube.com liked videos, ":ytfav" or "LL" for short (requires authentication)'
|
|
|
|
IE_DESC = 'YouTube.com liked videos, ":ytfav" or "LL" for short (requires authentication)'
|
|
|
|
_VALID_URL = r':ytfav(?:ou?rite)s?'
|
|
|
|
_VALID_URL = r':ytfav(?:ou?rite)?s?|LL'
|
|
|
|
_FEED_NAME = 'favourites'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
'url': ':ytfav',
|
|
|
|
'url': ':ytfav',
|
|
|
@ -3559,7 +3557,8 @@ class YoutubeFavouritesIE(YoutubeFeedsInfoExtractor):
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
return self.url_result('LL', ie=YoutubePlaylistIE.ie_key())
|
|
|
|
return self.url_result(
|
|
|
|
|
|
|
|
'https://www.youtube.com/playlist?list=LL', ie=YoutubeTabIE.ie_key())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class YoutubeRecommendedIE(YoutubeFeedsInfoExtractor):
|
|
|
|
class YoutubeRecommendedIE(YoutubeFeedsInfoExtractor):
|
|
|
|