From 5b2fdda5d6abf6ee2f3fe9e456f2dc8900a4510a Mon Sep 17 00:00:00 2001 From: Alexandre Huot Date: Sun, 30 Dec 2018 22:41:08 -0500 Subject: [PATCH] [toutv] Corrects issues #16398 - account don't work after redesign. --- youtube_dl/extractor/toutv.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/toutv.py b/youtube_dl/extractor/toutv.py index 2e7876cc5b3..f9ae8c2ea01 100644 --- a/youtube_dl/extractor/toutv.py +++ b/youtube_dl/extractor/toutv.py @@ -6,7 +6,6 @@ from .common import InfoExtractor from ..utils import ( int_or_none, - js_to_json, urlencode_postdata, extract_attributes, smuggle_url, @@ -46,14 +45,13 @@ def _real_initialize(self): email, password = self._get_login_info() if email is None: return - state = 'http://ici.tou.tv/' - webpage = self._download_webpage(state, None, 'Downloading homepage') - toutvlogin = self._parse_json(self._search_regex( - r'(?s)toutvlogin\s*=\s*({.+?});', webpage, 'toutvlogin'), None, js_to_json) - authorize_url = toutvlogin['host'] + '/auth/oauth/v2/authorize' + state = 'http://ici.tou.tv/app.js' + webpage = self._download_webpage(state, None, 'Downloading app.js script') + client_id = self._search_regex(r'document\.URL:{clientId:"(.+?)"', webpage, 'toutvclientid') + authorize_url = 'https://services.radio-canada.ca/auth/oauth/v2/authorize' login_webpage = self._download_webpage( authorize_url, None, 'Downloading login page', query={ - 'client_id': toutvlogin['clientId'], + 'client_id': client_id, 'redirect_uri': 'https://ici.tou.tv/login/loginCallback', 'response_type': 'token', 'scope': 'media-drmt openid profile email id.write media-validation.read.privileged',