mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-24 07:06:21 +00:00
[vimeo] Simplify set cookie
This commit is contained in:
parent
9a8a12b7d8
commit
9eab37dca0
@ -50,7 +50,7 @@ class VimeoBaseInfoExtractor(InfoExtractor):
|
|||||||
login_request = compat_urllib_request.Request(self._LOGIN_URL, data)
|
login_request = compat_urllib_request.Request(self._LOGIN_URL, data)
|
||||||
login_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
login_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
login_request.add_header('Referer', self._LOGIN_URL)
|
login_request.add_header('Referer', self._LOGIN_URL)
|
||||||
self._set_cookie('vimeo.com', 'vuid', vuid)
|
self._set_vimeo_cookie('vuid', vuid)
|
||||||
self._download_webpage(login_request, None, False, 'Wrong login info')
|
self._download_webpage(login_request, None, False, 'Wrong login info')
|
||||||
|
|
||||||
def _extract_xsrft_and_vuid(self, webpage):
|
def _extract_xsrft_and_vuid(self, webpage):
|
||||||
@ -62,6 +62,9 @@ class VimeoBaseInfoExtractor(InfoExtractor):
|
|||||||
webpage, 'vuid', group='vuid')
|
webpage, 'vuid', group='vuid')
|
||||||
return xsrft, vuid
|
return xsrft, vuid
|
||||||
|
|
||||||
|
def _set_vimeo_cookie(self, name, value):
|
||||||
|
self._set_cookie('vimeo.com', name, value)
|
||||||
|
|
||||||
|
|
||||||
class VimeoIE(VimeoBaseInfoExtractor):
|
class VimeoIE(VimeoBaseInfoExtractor):
|
||||||
"""Information extractor for vimeo.com."""
|
"""Information extractor for vimeo.com."""
|
||||||
@ -218,7 +221,7 @@ class VimeoIE(VimeoBaseInfoExtractor):
|
|||||||
password_request = compat_urllib_request.Request(url + '/password', data)
|
password_request = compat_urllib_request.Request(url + '/password', data)
|
||||||
password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
password_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
password_request.add_header('Referer', url)
|
password_request.add_header('Referer', url)
|
||||||
self._set_cookie('vimeo.com', 'vuid', vuid)
|
self._set_vimeo_cookie('vuid', vuid)
|
||||||
return self._download_webpage(
|
return self._download_webpage(
|
||||||
password_request, video_id,
|
password_request, video_id,
|
||||||
'Verifying the password', 'Wrong password')
|
'Verifying the password', 'Wrong password')
|
||||||
@ -494,8 +497,8 @@ class VimeoChannelIE(VimeoBaseInfoExtractor):
|
|||||||
password_url = compat_urlparse.urljoin(page_url, password_path)
|
password_url = compat_urlparse.urljoin(page_url, password_path)
|
||||||
password_request = compat_urllib_request.Request(password_url, post)
|
password_request = compat_urllib_request.Request(password_url, post)
|
||||||
password_request.add_header('Content-type', 'application/x-www-form-urlencoded')
|
password_request.add_header('Content-type', 'application/x-www-form-urlencoded')
|
||||||
self._set_cookie('vimeo.com', 'vuid', vuid)
|
self._set_vimeo_cookie('vuid', vuid)
|
||||||
self._set_cookie('vimeo.com', 'xsrft', token)
|
self._set_vimeo_cookie('xsrft', token)
|
||||||
|
|
||||||
return self._download_webpage(
|
return self._download_webpage(
|
||||||
password_request, list_id,
|
password_request, list_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user