aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWes <morganw@gmail.com>2021-07-30 17:05:56 -0500
committerGitHub <noreply@github.com>2021-07-31 03:35:56 +0530
commitd24734daeaf7a13c304fbdf285622a5a6477f3ef (patch)
tree8f5c22e2ad99da89fce997ef5905666a08fab664
parentd9e6e9481e74b8524938a86323a54170055c18f3 (diff)
downloadhypervideo-pre-d24734daeaf7a13c304fbdf285622a5a6477f3ef.tar.lz
hypervideo-pre-d24734daeaf7a13c304fbdf285622a5a6477f3ef.tar.xz
hypervideo-pre-d24734daeaf7a13c304fbdf285622a5a6477f3ef.zip
[adobepass] Add MSO Sling TV (#596)
Original PR: ytdl-org/youtube-dl#29686 Closes: #300, ytdl-org/youtube-dl#18132 Authored by: wesnm
-rw-r--r--yt_dlp/extractor/adobepass.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/yt_dlp/extractor/adobepass.py b/yt_dlp/extractor/adobepass.py
index 2a06bbd0c..9ac1d7793 100644
--- a/yt_dlp/extractor/adobepass.py
+++ b/yt_dlp/extractor/adobepass.py
@@ -1330,6 +1330,11 @@ MSO_INFO = {
'cou060': {
'name': 'Zito Media'
},
+ 'slingtv': {
+ 'name': 'Sling TV',
+ 'username_field': 'username',
+ 'password_field': 'password',
+ },
}
@@ -1565,6 +1570,40 @@ class AdobePassIE(InfoExtractor):
}), headers={
'Content-Type': 'application/x-www-form-urlencoded'
})
+ elif mso_id == 'slingtv':
+ # SlingTV has a meta-refresh based authentication, but also
+ # looks at the tab history to count the number of times the
+ # browser has been on a page
+
+ first_bookend_page, urlh = provider_redirect_page_res
+
+ hidden_data = self._hidden_inputs(first_bookend_page)
+ hidden_data['history'] = 1
+
+ provider_login_page_res = self._download_webpage_handle(
+ urlh.geturl(), video_id, 'Sending first bookend.',
+ query=hidden_data)
+
+ provider_association_redirect, urlh = post_form(
+ provider_login_page_res, 'Logging in', {
+ mso_info['username_field']: username,
+ mso_info['password_field']: password
+ })
+
+ provider_refresh_redirect_url = extract_redirect_url(
+ provider_association_redirect, url=urlh.geturl())
+
+ last_bookend_page, urlh = self._download_webpage_handle(
+ provider_refresh_redirect_url, video_id,
+ 'Downloading Auth Association Redirect Page')
+ hidden_data = self._hidden_inputs(last_bookend_page)
+ hidden_data['history'] = 3
+
+ mvpd_confirm_page_res = self._download_webpage_handle(
+ urlh.geturl(), video_id, 'Sending final bookend.',
+ query=hidden_data)
+
+ post_form(mvpd_confirm_page_res, 'Confirming Login')
else:
# Some providers (e.g. DIRECTV NOW) have another meta refresh
# based redirect that should be followed.