From 3383f85f432bb4cb90ae624bd6d7326c760ae814 Mon Sep 17 00:00:00 2001 From: Alexander Seiler Date: Sat, 28 Apr 2018 15:50:16 +0200 Subject: [PATCH] [zattoo] Implement requested code review changes. --- youtube_dl/extractor/zattoo.py | 83 ++++++++++++---------------------- 1 file changed, 29 insertions(+), 54 deletions(-) diff --git a/youtube_dl/extractor/zattoo.py b/youtube_dl/extractor/zattoo.py index bd4f49fb7..928f22566 100644 --- a/youtube_dl/extractor/zattoo.py +++ b/youtube_dl/extractor/zattoo.py @@ -18,7 +18,7 @@ class ZattooBaseIE(InfoExtractor): _NETRC_MACHINE = 'zattoo' _HOST_URL = 'https://zattoo.com' - _login_info = {} + _power_guide_hash = None def _login(self, uuid, session_id): (username, password) = self._get_login_info() @@ -39,20 +39,11 @@ class ZattooBaseIE(InfoExtractor): request.add_header( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8') request.add_header( - 'Cookie', self._generate_cookie(uuid, session_id)) + 'Cookie', 'uuid=%s; beaker.session.id=%s' % (uuid, session_id)) response = self._request_webpage( request, None, 'Logging in') - cookie = response.headers.get('Set-Cookie') - pzuid = self._search_regex(r'pzuid\s*=\s*(.+?);', cookie, 'pzuid') data = self._parse_json(response.read(), None) - - return { - 'ppid': data['session']['ppid'], - 'powerhash': data['session']['power_guide_hash'], - 'pzuid': pzuid, - 'uuid': uuid, - 'session_id': session_id - } + return data['session']['power_guide_hash'] def _get_app_token_and_version(self): host_webpage = self._download_webpage( @@ -60,7 +51,7 @@ class ZattooBaseIE(InfoExtractor): app_token = self._html_search_regex( r'