mirror of https://github.com/yt-dlp/yt-dlp.git
[generic] Add support for protocol-independent URLs (Fixes #2810)
This commit is contained in:
parent
29645a1d44
commit
ebd3c7b370
|
@ -248,6 +248,18 @@ class GenericIE(InfoExtractor):
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Honda’s New Asimo Robot Is More Human Than Ever',
|
'title': 'Honda’s New Asimo Robot Is More Human Than Ever',
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
# Dailymotion embed
|
||||||
|
{
|
||||||
|
'url': 'http://www.spi0n.com/zap-spi0n-com-n216/',
|
||||||
|
'md5': '441aeeb82eb72c422c7f14ec533999cd',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'k2mm4bCdJ6CQ2i7c8o2',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Le Zap de Spi0n n°216 - Zapping du Web',
|
||||||
|
'uploader': 'Spi0n',
|
||||||
|
},
|
||||||
|
'add_ie': ['Dailymotion'],
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -333,6 +345,15 @@ class GenericIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
if url.startswith('//'):
|
||||||
|
return {
|
||||||
|
'_type': 'url',
|
||||||
|
'url': (
|
||||||
|
'http:'
|
||||||
|
if self._downloader.params.get('prefer_insecure', False)
|
||||||
|
else 'https:') + url,
|
||||||
|
}
|
||||||
|
|
||||||
parsed_url = compat_urlparse.urlparse(url)
|
parsed_url = compat_urlparse.urlparse(url)
|
||||||
if not parsed_url.scheme:
|
if not parsed_url.scheme:
|
||||||
default_search = self._downloader.params.get('default_search')
|
default_search = self._downloader.params.get('default_search')
|
||||||
|
@ -469,7 +490,7 @@ class GenericIE(InfoExtractor):
|
||||||
matches = re.findall(
|
matches = re.findall(
|
||||||
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/embed/video/.+?)\1', webpage)
|
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dailymotion\.com/embed/video/.+?)\1', webpage)
|
||||||
if matches:
|
if matches:
|
||||||
urlrs = [self.url_result(unescapeHTML(tuppl[1]), 'Dailymotion')
|
urlrs = [self.url_result(unescapeHTML(tuppl[1]))
|
||||||
for tuppl in matches]
|
for tuppl in matches]
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
urlrs, playlist_id=video_id, playlist_title=video_title)
|
urlrs, playlist_id=video_id, playlist_title=video_title)
|
||||||
|
|
Loading…
Reference in New Issue