diff --git a/youtube_dl/extractor/zattoo.py b/youtube_dl/extractor/zattoo.py index 8cbef4e44..a44e7ac22 100644 --- a/youtube_dl/extractor/zattoo.py +++ b/youtube_dl/extractor/zattoo.py @@ -1,7 +1,7 @@ # coding: utf-8 from __future__ import unicode_literals -import uuid +from uuid import uuid4 import re from .common import InfoExtractor @@ -10,16 +10,17 @@ from ..utils import ( ExtractorError, sanitized_Request, urlencode_postdata, - urljoin, ) class ZattooBaseIE(InfoExtractor): _NETRC_MACHINE = 'zattoo' - _HOST_URL = 'https://zattoo.com/' + _HOST_URL = 'https://zattoo.com' - def _login(self, uuid, session_id, video_id): + _login_info = {} + + def _login(self, uuid, session_id): (username, password) = self._get_login_info() if not username or not password: raise ExtractorError( @@ -31,20 +32,19 @@ class ZattooBaseIE(InfoExtractor): 'remember': True, } request = sanitized_Request( - urljoin(self._HOST_URL, '/zapi/v2/account/login'), + '%s/zapi/v2/account/login' % self._HOST_URL, urlencode_postdata(login_form)) request.add_header( - 'Referer', urljoin(self._HOST_URL, '/login')) + 'Referer', '%s/login' % self._HOST_URL) request.add_header( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8') request.add_header( 'Cookie', self._generate_cookie(uuid, session_id)) response = self._request_webpage( - request, video_id, 'Logging in as %s' % login_form['login']) + request, None, 'Logging in as %s' % login_form['login']) cookie = response.headers.get('Set-Cookie') pzuid = self._search_regex(r'pzuid\s*=\s*(.+?);', cookie, 'pzuid') - data = self._parse_json( - response.read(), video_id) + data = self._parse_json(response.read(), None) return { 'ppid': data['session']['ppid'], @@ -54,16 +54,16 @@ class ZattooBaseIE(InfoExtractor): 'session_id': session_id } - def _get_app_token_and_version(self, video_id): + def _get_app_token_and_version(self): host_webpage = self._download_webpage( - self._HOST_URL, video_id) + self._HOST_URL, None, 'Downloading %s' % self._HOST_URL) app_token = self._html_search_regex( r'