mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[adobepass] Allow cookies for authenticating MSO
Possible workaround for #1034
This commit is contained in:
parent
490110c543
commit
b2a2d91310
1 changed files with 33 additions and 25 deletions
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
import urllib.error
|
||||||
import xml.etree.ElementTree as etree
|
import xml.etree.ElementTree as etree
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
@ -1435,27 +1436,29 @@ def extract_redirect_url(html, url=None, fatal=False):
|
||||||
if authn_token and is_expired(authn_token, 'simpleTokenExpires'):
|
if authn_token and is_expired(authn_token, 'simpleTokenExpires'):
|
||||||
authn_token = None
|
authn_token = None
|
||||||
if not authn_token:
|
if not authn_token:
|
||||||
# TODO add support for other TV Providers
|
|
||||||
mso_id = self.get_param('ap_mso')
|
mso_id = self.get_param('ap_mso')
|
||||||
|
if mso_id:
|
||||||
|
username, password = self._get_login_info('ap_username', 'ap_password', mso_id)
|
||||||
|
if not username or not password:
|
||||||
|
raise_mvpd_required()
|
||||||
|
mso_info = MSO_INFO[mso_id]
|
||||||
|
|
||||||
|
provider_redirect_page_res = self._download_webpage_handle(
|
||||||
|
self._SERVICE_PROVIDER_TEMPLATE % 'authenticate/saml', video_id,
|
||||||
|
'Downloading Provider Redirect Page', query={
|
||||||
|
'noflash': 'true',
|
||||||
|
'mso_id': mso_id,
|
||||||
|
'requestor_id': requestor_id,
|
||||||
|
'no_iframe': 'false',
|
||||||
|
'domain_name': 'adobe.com',
|
||||||
|
'redirect_url': url,
|
||||||
|
})
|
||||||
|
elif not self._cookies_passed:
|
||||||
|
raise_mvpd_required()
|
||||||
|
|
||||||
if not mso_id:
|
if not mso_id:
|
||||||
raise_mvpd_required()
|
pass
|
||||||
username, password = self._get_login_info('ap_username', 'ap_password', mso_id)
|
elif mso_id == 'Comcast_SSO':
|
||||||
if not username or not password:
|
|
||||||
raise_mvpd_required()
|
|
||||||
mso_info = MSO_INFO[mso_id]
|
|
||||||
|
|
||||||
provider_redirect_page_res = self._download_webpage_handle(
|
|
||||||
self._SERVICE_PROVIDER_TEMPLATE % 'authenticate/saml', video_id,
|
|
||||||
'Downloading Provider Redirect Page', query={
|
|
||||||
'noflash': 'true',
|
|
||||||
'mso_id': mso_id,
|
|
||||||
'requestor_id': requestor_id,
|
|
||||||
'no_iframe': 'false',
|
|
||||||
'domain_name': 'adobe.com',
|
|
||||||
'redirect_url': url,
|
|
||||||
})
|
|
||||||
|
|
||||||
if mso_id == 'Comcast_SSO':
|
|
||||||
# Comcast page flow varies by video site and whether you
|
# Comcast page flow varies by video site and whether you
|
||||||
# are on Comcast's network.
|
# are on Comcast's network.
|
||||||
provider_redirect_page, urlh = provider_redirect_page_res
|
provider_redirect_page, urlh = provider_redirect_page_res
|
||||||
|
@ -1711,12 +1714,17 @@ def extract_redirect_url(html, url=None, fatal=False):
|
||||||
if mso_id != 'Rogers':
|
if mso_id != 'Rogers':
|
||||||
post_form(mvpd_confirm_page_res, 'Confirming Login')
|
post_form(mvpd_confirm_page_res, 'Confirming Login')
|
||||||
|
|
||||||
session = self._download_webpage(
|
try:
|
||||||
self._SERVICE_PROVIDER_TEMPLATE % 'session', video_id,
|
session = self._download_webpage(
|
||||||
'Retrieving Session', data=urlencode_postdata({
|
self._SERVICE_PROVIDER_TEMPLATE % 'session', video_id,
|
||||||
'_method': 'GET',
|
'Retrieving Session', data=urlencode_postdata({
|
||||||
'requestor_id': requestor_id,
|
'_method': 'GET',
|
||||||
}), headers=mvpd_headers)
|
'requestor_id': requestor_id,
|
||||||
|
}), headers=mvpd_headers)
|
||||||
|
except ExtractorError as e:
|
||||||
|
if not mso_id and isinstance(e.cause, urllib.error.HTTPError) and e.cause.code == 401:
|
||||||
|
raise_mvpd_required()
|
||||||
|
raise
|
||||||
if '<pendingLogout' in session:
|
if '<pendingLogout' in session:
|
||||||
self._downloader.cache.store(self._MVPD_CACHE, requestor_id, {})
|
self._downloader.cache.store(self._MVPD_CACHE, requestor_id, {})
|
||||||
count += 1
|
count += 1
|
||||||
|
|
Loading…
Reference in a new issue