[generic] Detect Invidious' link element (Closes #195)

This commit is contained in:
pukkandan 2021-04-01 17:13:35 +05:30
parent 3f6a90eb63
commit df0c81513e
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

View File

@ -2659,6 +2659,15 @@ def _real_extract(self, url):
if vid_me_embed_url is not None: if vid_me_embed_url is not None:
return self.url_result(vid_me_embed_url, 'Vidme') return self.url_result(vid_me_embed_url, 'Vidme')
# Invidious Instances
# https://github.com/yt-dlp/yt-dlp/issues/195
# https://github.com/iv-org/invidious/pull/1730
youtube_url = self._search_regex(
r'<link rel="alternate" href="(https://www\.youtube\.com/watch\?v=[0-9A-Za-z_-]{11})"',
webpage, 'youtube link', default=None)
if youtube_url:
return self.url_result(youtube_url, YoutubeIE.ie_key())
# Look for YouTube embeds # Look for YouTube embeds
youtube_urls = YoutubeIE._extract_urls(webpage) youtube_urls = YoutubeIE._extract_urls(webpage)
if youtube_urls: if youtube_urls: