|
|
@ -40,6 +40,18 @@ class VimeoBaseInfoExtractor(InfoExtractor):
|
|
|
|
_LOGIN_REQUIRED = False
|
|
|
|
_LOGIN_REQUIRED = False
|
|
|
|
_LOGIN_URL = 'https://vimeo.com/log_in'
|
|
|
|
_LOGIN_URL = 'https://vimeo.com/log_in'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def _smuggle_referrer(url, referrer_url):
|
|
|
|
|
|
|
|
return smuggle_url(url, {'http_headers': {'Referer': referrer_url}})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _unsmuggle_headers(self, url):
|
|
|
|
|
|
|
|
"""@returns (url, smuggled_data, headers)"""
|
|
|
|
|
|
|
|
url, data = unsmuggle_url(url, {})
|
|
|
|
|
|
|
|
headers = self.get_param('http_headers').copy()
|
|
|
|
|
|
|
|
if 'http_headers' in data:
|
|
|
|
|
|
|
|
headers.update(data['http_headers'])
|
|
|
|
|
|
|
|
return url, data, headers
|
|
|
|
|
|
|
|
|
|
|
|
def _perform_login(self, username, password):
|
|
|
|
def _perform_login(self, username, password):
|
|
|
|
webpage = self._download_webpage(
|
|
|
|
webpage = self._download_webpage(
|
|
|
|
self._LOGIN_URL, None, 'Downloading login page')
|
|
|
|
self._LOGIN_URL, None, 'Downloading login page')
|
|
|
@ -717,10 +729,6 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|
|
|
# vimeo embed with check-password page protected by Referer header
|
|
|
|
# vimeo embed with check-password page protected by Referer header
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def _smuggle_referrer(url, referrer_url):
|
|
|
|
|
|
|
|
return smuggle_url(url, {'http_headers': {'Referer': referrer_url}})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def _extract_urls(url, webpage):
|
|
|
|
def _extract_urls(url, webpage):
|
|
|
|
urls = []
|
|
|
|
urls = []
|
|
|
@ -754,8 +762,8 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
checked = self._download_json(
|
|
|
|
checked = self._download_json(
|
|
|
|
url + '/check-password', video_id,
|
|
|
|
f'{compat_urlparse.urlsplit(url)._replace(query=None).geturl()}/check-password',
|
|
|
|
'Verifying the password', data=data, headers=headers)
|
|
|
|
video_id, 'Verifying the password', data=data, headers=headers)
|
|
|
|
if checked is False:
|
|
|
|
if checked is False:
|
|
|
|
raise ExtractorError('Wrong video password', expected=True)
|
|
|
|
raise ExtractorError('Wrong video password', expected=True)
|
|
|
|
return checked
|
|
|
|
return checked
|
|
|
@ -830,10 +838,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|
|
|
raise
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
url, data = unsmuggle_url(url, {})
|
|
|
|
url, data, headers = self._unsmuggle_headers(url)
|
|
|
|
headers = self.get_param('http_headers').copy()
|
|
|
|
|
|
|
|
if 'http_headers' in data:
|
|
|
|
|
|
|
|
headers.update(data['http_headers'])
|
|
|
|
|
|
|
|
if 'Referer' not in headers:
|
|
|
|
if 'Referer' not in headers:
|
|
|
|
headers['Referer'] = url
|
|
|
|
headers['Referer'] = url
|
|
|
|
|
|
|
|
|
|
|
@ -1383,14 +1388,15 @@ class VHXEmbedIE(VimeoBaseInfoExtractor):
|
|
|
|
_VALID_URL = r'https?://embed\.vhx\.tv/videos/(?P<id>\d+)'
|
|
|
|
_VALID_URL = r'https?://embed\.vhx\.tv/videos/(?P<id>\d+)'
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def _extract_url(webpage):
|
|
|
|
def _extract_url(url, webpage):
|
|
|
|
mobj = re.search(
|
|
|
|
mobj = re.search(
|
|
|
|
r'<iframe[^>]+src="(https?://embed\.vhx\.tv/videos/\d+[^"]*)"', webpage)
|
|
|
|
r'<iframe[^>]+src="(https?://embed\.vhx\.tv/videos/\d+[^"]*)"', webpage)
|
|
|
|
return unescapeHTML(mobj.group(1)) if mobj else None
|
|
|
|
return VimeoIE._smuggle_referrer(unescapeHTML(mobj.group(1)), url) if mobj else None
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
url, _, headers = self._unsmuggle_headers(url)
|
|
|
|
|
|
|
|
webpage = self._download_webpage(url, video_id, headers=headers)
|
|
|
|
config_url = self._parse_json(self._search_regex(
|
|
|
|
config_url = self._parse_json(self._search_regex(
|
|
|
|
r'window\.OTTData\s*=\s*({.+})', webpage,
|
|
|
|
r'window\.OTTData\s*=\s*({.+})', webpage,
|
|
|
|
'ott data'), video_id, js_to_json)['config_url']
|
|
|
|
'ott data'), video_id, js_to_json)['config_url']
|
|
|
|