Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[neomagazin] Add new extractor #13639

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,18 +1196,15 @@ def test_dfxp2srt(self):
srt_data = '''1
00:00:02,080 --> 00:00:05,839
<font color="white" face="sansSerif" size="16">default style<font color="red">custom style</font></font>

2
00:00:02,080 --> 00:00:05,839
<b><font color="cyan" face="sansSerif" size="16"><font color="lime">part 1
</font>part 2</font></b>

3
2
00:00:05,839 --> 00:00:09,560
<u><font color="lime">line 3
part 3</font></u>

4
3
00:00:09,560 --> 00:00:12,359
<i><u><font color="yellow"><font color="lime">inner
</font>style</font></u></i>
Expand Down
61 changes: 44 additions & 17 deletions youtube_dl/extractor/adobepass.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# coding: utf-8
from __future__ import unicode_literals

import base64
import json
import re
import time
import xml.etree.ElementTree as etree
Expand Down Expand Up @@ -60,6 +62,9 @@
'username_field': 'IDToken1',
'password_field': 'IDToken2',
},
'Fubo': {
'name': 'FuboTV',
},
'thr030': {
'name': '3 Rivers Communications'
},
Expand Down Expand Up @@ -1422,11 +1427,11 @@ def extract_redirect_url(html, url=None, fatal=False):
'domain_name': 'adobe.com',
'redirect_url': url,
})
provider_redirect_page, urlh = provider_redirect_page_res

if mso_id == 'Comcast_SSO':
# Comcast page flow varies by video site and whether you
# are on Comcast's network.
provider_redirect_page, urlh = provider_redirect_page_res
if 'automatically signing you in' in provider_redirect_page:
oauth_redirect_url = self._html_search_regex(
r'window\.location\s*=\s*[\'"]([^\'"]+)',
Expand Down Expand Up @@ -1458,7 +1463,6 @@ def extract_redirect_url(html, url=None, fatal=False):
elif mso_id == 'Verizon':
# In general, if you're connecting from a Verizon-assigned IP,
# you will not actually pass your credentials.
provider_redirect_page, urlh = provider_redirect_page_res
if 'Please wait ...' in provider_redirect_page:
saml_redirect_url = self._html_search_regex(
r'self\.parent\.location=(["\'])(?P<url>.+?)\1',
Expand Down Expand Up @@ -1492,21 +1496,44 @@ def extract_redirect_url(html, url=None, fatal=False):
'Content-Type': 'application/x-www-form-urlencoded'
})
else:
# Some providers (e.g. DIRECTV NOW) have another meta refresh
# based redirect that should be followed.
provider_redirect_page, urlh = provider_redirect_page_res
provider_refresh_redirect_url = extract_redirect_url(
provider_redirect_page, url=urlh.geturl())
if provider_refresh_redirect_url:
provider_redirect_page_res = self._download_webpage_handle(
provider_refresh_redirect_url, video_id,
'Downloading Provider Redirect Page (meta refresh)')
provider_login_page_res = post_form(
provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE)
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
mso_info.get('username_field', 'username'): username,
mso_info.get('password_field', 'password'): password,
})
if mso_id == 'Fubo':
config_b64 = self._html_search_regex(r"window.atob\('(.*)'\)\)\)\);",
provider_redirect_page, 'client id', fatal=True)
config_json = base64.b64decode(config_b64.encode()).decode('ascii')
config = json.loads(config_json)

post_data = {
'username': username,
'password': password,
'client_id': config['clientID'],
'tenant': config['auth0Tenant'],
'sso': True,
'connection': 'Username-Password-Authentication',
'redirect_uri': config['callbackURL'],
}
post_data.update(config['extraParams'])
base_url = config.get('authorizationServer', {}).get(url, 'https://fubo.auth0.com')

mvpd_confirm_page_res = self._download_webpage_handle(
base_url + '/usernamepassword/login', video_id, 'Logging in',
data=json.dumps(post_data).encode(),
headers={'Content-Type': 'application/json'})
else:
# Some providers (e.g. DIRECTV NOW) have another meta refresh
# based redirect that should be followed.
provider_refresh_redirect_url = extract_redirect_url(
provider_redirect_page, url=urlh.geturl())
if provider_refresh_redirect_url:
provider_redirect_page_res = self._download_webpage_handle(
provider_refresh_redirect_url, video_id,
'Downloading Provider Redirect Page (meta refresh)')
provider_login_page_res = post_form(
provider_redirect_page_res, self._DOWNLOADING_LOGIN_PAGE)
mvpd_confirm_page_res = post_form(provider_login_page_res, 'Logging in', {
mso_info.get('username_field', 'username'): username,
mso_info.get('password_field', 'password'): password,
})

if mso_id != 'Rogers':
post_form(mvpd_confirm_page_res, 'Confirming Login')

Expand Down
Loading