diff options
author | Remita Amine <remitamine@gmail.com> | 2016-08-14 11:52:48 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2016-08-14 11:55:28 +0100 |
commit | 9771b1f901b19ad5ba6632a37fc6348e8e6e98dd (patch) | |
tree | eb67e7fdca264fed483d11a00aecffaf766d90d1 /youtube_dl/extractor/theplatform.py | |
parent | 2118fdd1a96ed7a904b53ed5aad50a203d0e0c70 (diff) |
[theplatform] use _get_netrc_login_info and fix session expiration check(#10345)
Diffstat (limited to 'youtube_dl/extractor/theplatform.py')
-rw-r--r-- | youtube_dl/extractor/theplatform.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/extractor/theplatform.py b/youtube_dl/extractor/theplatform.py index bb3efc4ea..9ca765a5f 100644 --- a/youtube_dl/extractor/theplatform.py +++ b/youtube_dl/extractor/theplatform.py @@ -218,15 +218,16 @@ class ThePlatformIE(ThePlatformBaseIE): requestor_info = self._downloader.cache.load('mvpd', requestor_id) or {} authn_token = requestor_info.get('authn_token') if authn_token: - token_expires = unified_timestamp(xml_text(authn_token, 'simpleTokenExpires').replace('_GMT', '')) - if token_expires and token_expires >= time.time(): + token_expires = unified_timestamp(re.sub(r'[_ ]GMT', '', xml_text(authn_token, 'simpleTokenExpires'))) + if token_expires and token_expires <= int(time.time()): authn_token = None + requestor_info = {} if not authn_token: # TODO add support for other TV Providers mso_id = 'DTV' - login_info = netrc.netrc().authenticators(mso_id) - if not login_info: - return None + username, password = self._get_netrc_login_info(mso_id) + if not username or not password: + return '' def post_form(form_page, note, data={}): post_url = self._html_search_regex(r'<form[^>]+action=(["\'])(?P<url>.+?)\1', form_page, 'post url', group='url') @@ -248,8 +249,8 @@ class ThePlatformIE(ThePlatformBaseIE): provider_login_page = post_form( provider_redirect_page, 'Downloading Provider Login Page') mvpd_confirm_page = post_form(provider_login_page, 'Logging in', { - 'username': login_info[0], - 'password': login_info[2], + 'username': username, + 'password': password, }) post_form(mvpd_confirm_page, 'Confirming Login') |