[toutv] Corrects issues #16398 - account don't work after redesign.

This commit is contained in:
Alexandre Huot 2018-12-30 22:41:08 -05:00
parent e1a0628797
commit 5b2fdda5d6

View File

@ -6,7 +6,6 @@ import re
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
int_or_none, int_or_none,
js_to_json,
urlencode_postdata, urlencode_postdata,
extract_attributes, extract_attributes,
smuggle_url, smuggle_url,
@ -46,14 +45,13 @@ class TouTvIE(InfoExtractor):
email, password = self._get_login_info() email, password = self._get_login_info()
if email is None: if email is None:
return return
state = 'http://ici.tou.tv/' state = 'http://ici.tou.tv/app.js'
webpage = self._download_webpage(state, None, 'Downloading homepage') webpage = self._download_webpage(state, None, 'Downloading app.js script')
toutvlogin = self._parse_json(self._search_regex( client_id = self._search_regex(r'document\.URL:{clientId:"(.+?)"', webpage, 'toutvclientid')
r'(?s)toutvlogin\s*=\s*({.+?});', webpage, 'toutvlogin'), None, js_to_json) authorize_url = 'https://services.radio-canada.ca/auth/oauth/v2/authorize'
authorize_url = toutvlogin['host'] + '/auth/oauth/v2/authorize'
login_webpage = self._download_webpage( login_webpage = self._download_webpage(
authorize_url, None, 'Downloading login page', query={ authorize_url, None, 'Downloading login page', query={
'client_id': toutvlogin['clientId'], 'client_id': client_id,
'redirect_uri': 'https://ici.tou.tv/login/loginCallback', 'redirect_uri': 'https://ici.tou.tv/login/loginCallback',
'response_type': 'token', 'response_type': 'token',
'scope': 'media-drmt openid profile email id.write media-validation.read.privileged', 'scope': 'media-drmt openid profile email id.write media-validation.read.privileged',