[vimeo] Use _search_regex

This commit is contained in:
Philipp Hagemeister 2014-01-07 05:19:28 +01:00
parent 9148eb002b
commit fcee8ee784

View file

@ -93,7 +93,7 @@ def _login(self):
self.report_login() self.report_login()
login_url = 'https://vimeo.com/log_in' login_url = 'https://vimeo.com/log_in'
webpage = self._download_webpage(login_url, None, False) webpage = self._download_webpage(login_url, None, False)
token = re.search(r'xsrft: \'(.*?)\'', webpage).group(1) token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
data = compat_urllib_parse.urlencode({'email': username, data = compat_urllib_parse.urlencode({'email': username,
'password': password, 'password': password,
'action': 'login', 'action': 'login',
@ -109,7 +109,7 @@ def _verify_video_password(self, url, video_id, webpage):
password = self._downloader.params.get('videopassword', None) password = self._downloader.params.get('videopassword', None)
if password is None: if password is None:
raise ExtractorError('This video is protected by a password, use the --video-password option') raise ExtractorError('This video is protected by a password, use the --video-password option')
token = re.search(r'xsrft: \'(.*?)\'', webpage).group(1) token = self._search_regex(r'xsrft: \'(.*?)\'', webpage, 'login token')
data = compat_urllib_parse.urlencode({'password': password, data = compat_urllib_parse.urlencode({'password': password,
'token': token}) 'token': token})
# I didn't manage to use the password with https # I didn't manage to use the password with https