1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-03 16:33:22 +08:00

Support Vimeo urls with query strings

This commit is contained in:
Aarni Koskela 2017-02-12 23:57:42 +02:00
parent 0dac7cbb09
commit de36edbf4c

View File

@ -190,7 +190,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
) )
\. \.
)? )?
vimeo(?P<pro>pro)?\.com/ vimeo\.com/
(?!(?:channels|album)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/) (?!(?:channels|album)/[^/?#]+/?(?:$|[?#])|[^/]+/review/|ondemand/)
(?:.*?/)? (?:.*?/)?
(?: (?:
@ -201,7 +201,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
(?:videos?/)? (?:videos?/)?
(?P<id>[0-9]+) (?P<id>[0-9]+)
(?:/[\da-f]+)? (?:/[\da-f]+)?
/?(?:[?&].*)?(?:[#].*)?$ /?(?P<qs>(?:[?&].*)?(?:[#].*)?)$
''' '''
IE_NAME = 'vimeo' IE_NAME = 'vimeo'
_TESTS = [ _TESTS = [
@ -453,11 +453,15 @@ class VimeoIE(VimeoBaseInfoExtractor):
mobj = re.match(self._VALID_URL, url) mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('id') video_id = mobj.group('id')
orig_url = url orig_url = url
if mobj.group('pro') or mobj.group('player'): if mobj.group('player'):
url = 'https://player.vimeo.com/video/' + video_id url = 'https://player.vimeo.com/video/' + video_id
elif any(p in url for p in ('play_redirect_hls', 'moogaloop.swf')): elif any(p in url for p in ('play_redirect_hls', 'moogaloop.swf')):
url = 'https://vimeo.com/' + video_id url = 'https://vimeo.com/' + video_id
if mobj.group('qs'):
# Some vimeopro embeds have query strings (`?portfolio_id=NNNNNN`) which are necessary
url += mobj.group('qs')
# Retrieve video webpage to extract further information # Retrieve video webpage to extract further information
request = sanitized_Request(url, headers=headers) request = sanitized_Request(url, headers=headers)
try: try:
@ -571,7 +575,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
if not video_description: if not video_description:
video_description = self._html_search_meta( video_description = self._html_search_meta(
'description', webpage, default=None) 'description', webpage, default=None)
if not video_description and mobj.group('pro'): if not video_description:
orig_webpage = self._download_webpage( orig_webpage = self._download_webpage(
orig_url, video_id, orig_url, video_id,
note='Downloading webpage for description', note='Downloading webpage for description',