[generic] Add support for multiple vimeo embeds (Closes #10862)
This commit is contained in:
parent
33898fb19c
commit
09b9c45e24
|
@ -1754,9 +1754,9 @@ class GenericIE(InfoExtractor):
|
||||||
if matches:
|
if matches:
|
||||||
return _playlist_from_matches(matches, ie='RtlNl')
|
return _playlist_from_matches(matches, ie='RtlNl')
|
||||||
|
|
||||||
vimeo_url = VimeoIE._extract_vimeo_url(url, webpage)
|
vimeo_urls = VimeoIE._extract_urls(url, webpage)
|
||||||
if vimeo_url is not None:
|
if vimeo_urls:
|
||||||
return self.url_result(vimeo_url)
|
return _playlist_from_matches(vimeo_urls, ie=VimeoIE.ie_key())
|
||||||
|
|
||||||
vid_me_embed_url = self._search_regex(
|
vid_me_embed_url = self._search_regex(
|
||||||
r'src=[\'"](https?://vid\.me/[^\'"]+)[\'"]',
|
r'src=[\'"](https?://vid\.me/[^\'"]+)[\'"]',
|
||||||
|
|
|
@ -355,23 +355,27 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
||||||
return smuggle_url(url, {'http_headers': {'Referer': referrer_url}})
|
return smuggle_url(url, {'http_headers': {'Referer': referrer_url}})
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _extract_vimeo_url(url, webpage):
|
def _extract_urls(url, webpage):
|
||||||
|
urls = []
|
||||||
# Look for embedded (iframe) Vimeo player
|
# Look for embedded (iframe) Vimeo player
|
||||||
mobj = re.search(
|
for mobj in re.finditer(
|
||||||
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//player\.vimeo\.com/video/.+?)\1', webpage)
|
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//player\.vimeo\.com/video/.+?)\1', webpage):
|
||||||
if mobj:
|
urls.append(VimeoIE._smuggle_referrer(unescapeHTML(mobj.group('url')), url))
|
||||||
player_url = unescapeHTML(mobj.group('url'))
|
PLAIN_EMBED_RE = (
|
||||||
return VimeoIE._smuggle_referrer(player_url, url)
|
# Look for embedded (swf embed) Vimeo player
|
||||||
# Look for embedded (swf embed) Vimeo player
|
r'<embed[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/moogaloop\.swf.+?)\1',
|
||||||
mobj = re.search(
|
# Look more for non-standard embedded Vimeo player
|
||||||
r'<embed[^>]+?src="((?:https?:)?//(?:www\.)?vimeo\.com/moogaloop\.swf.+?)"', webpage)
|
r'<video[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/[0-9]+)\1',
|
||||||
if mobj:
|
)
|
||||||
return mobj.group(1)
|
for embed_re in PLAIN_EMBED_RE:
|
||||||
# Look more for non-standard embedded Vimeo player
|
for mobj in re.finditer(embed_re, webpage):
|
||||||
mobj = re.search(
|
urls.append(mobj.group('url'))
|
||||||
r'<video[^>]+src=(?P<q1>[\'"])(?P<url>(?:https?:)?//(?:www\.)?vimeo\.com/[0-9]+)(?P=q1)', webpage)
|
return urls
|
||||||
if mobj:
|
|
||||||
return mobj.group('url')
|
@staticmethod
|
||||||
|
def _extract_url(url, webpage):
|
||||||
|
urls = VimeoIE._extract_urls(url, webpage)
|
||||||
|
return urls[0] if urls else None
|
||||||
|
|
||||||
def _verify_player_video_password(self, url, video_id):
|
def _verify_player_video_password(self, url, video_id):
|
||||||
password = self._downloader.params.get('videopassword')
|
password = self._downloader.params.get('videopassword')
|
||||||
|
|
|
@ -341,7 +341,7 @@ class VKIE(VKBaseIE):
|
||||||
if youtube_url:
|
if youtube_url:
|
||||||
return self.url_result(youtube_url, 'Youtube')
|
return self.url_result(youtube_url, 'Youtube')
|
||||||
|
|
||||||
vimeo_url = VimeoIE._extract_vimeo_url(url, info_page)
|
vimeo_url = VimeoIE._extract_url(url, info_page)
|
||||||
if vimeo_url is not None:
|
if vimeo_url is not None:
|
||||||
return self.url_result(vimeo_url)
|
return self.url_result(vimeo_url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue