Skip to content

Commit

Permalink
Merge pull request ytdl-org#1 from Sipherdrakon/ScienceChannel-Update
Browse files Browse the repository at this point in the history
Science Channel Update
  • Loading branch information
Sipherdrakon authored Jul 25, 2021
2 parents a803582 + 48181c5 commit 2903eb5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions youtube_dl/extractor/dplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,41 @@ def _real_extract(self, url):
display_id = self._match_id(url)
return self._get_disco_api_info(
url, display_id, 'eu1-prod.disco-api.com', 'hgtv', 'de')

class ScienceChannelIE(DPlayIE):
_VALID_URL = r'https?://(?:www\.)?sciencechannel\.com/video' + DPlayIE._PATH_REGEX
_TESTS = [{
'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
'info_dict': {
'id': '2842849',
'display_id': 'strangest-things-science-atve-us/nazi-mystery-machine',
'ext': 'mp4',
'title': 'Nazi Mystery Machine',
'description': 'Experts investigate the secrets of a revolutionary encryption machine.',
'season_number': 1,
'episode_number': 1,
},
'skip': 'Available for Premium users',
}]

def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
headers['x-disco-client'] = 'WEB:UNKNOWN:sci:15.0.0'

def _download_video_playback_info(self, disco_base, video_id, headers):
return self._download_json(
disco_base + 'playback/v3/videoPlaybackInfo',
video_id, headers=headers, data=json.dumps({
'deviceInfo': {
'adBlocker': False,
},
'videoId': video_id,
'wisteriaProperties': {
'platform': 'desktop',
'product': 'sci',
},
}).encode('utf-8'))['data']['attributes']['streaming']

def _real_extract(self, url):
display_id = self._match_id(url)
return self._get_disco_api_info(
url, display_id, 'us1-prod-direct.sciencechannel.com', 'go', 'us')
1 change: 1 addition & 0 deletions youtube_dl/extractor/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
DPlayIE,
DiscoveryPlusIE,
HGTVDeIE,
ScienceChannelIE
)
from .dreisat import DreiSatIE
from .drbonanza import DRBonanzaIE
Expand Down

0 comments on commit 2903eb5

Please sign in to comment.