2 from __future__ import unicode_literals
9 from .anvato import AnvatoIE
10 from .common import InfoExtractor
18 class ScrippsNetworksWatchIE(AWSIE):
19 IE_NAME = 'scrippsnetworks:watch'
23 (?P<site>geniuskitchen)\.com/
25 player\.[A-Z0-9]+\.html\#|
32 'url': 'http://watch.geniuskitchen.com/player/3787617/Ample-Hills-Ice-Cream-Bike/',
36 'title': 'Ample Hills Ice Cream Bike',
37 'description': 'Courtney Rada churns up a signature GK Now ice cream with The Scoopmaster.',
39 'upload_date': '20171011',
40 'timestamp': 1507698000,
43 'skip_download': True,
45 'add_ie': [AnvatoIE.ie_key()],
49 'geniuskitchen': 'genius',
52 _AWS_API_KEY = 'E7wSQmq0qK6xPrF13WmzKiHo4BQ7tip4pQcSXVl1'
53 _AWS_PROXY_HOST = 'web.api.video.snidigital.com'
55 _AWS_USER_AGENT = 'aws-sdk-js/2.80.0 callback'
57 def _real_extract(self, url):
58 mobj = re.match(self._VALID_URL, url)
59 site_id, video_id = mobj.group('site', 'id')
61 aws_identity_id_json = json.dumps({
62 'IdentityId': '%s:7655847c-0ae7-4d9b-80d6-56c062927eb3' % self._AWS_REGION
64 token = self._download_json(
65 'https://cognito-identity.%s.amazonaws.com/' % self._AWS_REGION, video_id,
66 data=aws_identity_id_json,
69 'Content-Type': 'application/x-amz-json-1.1',
71 'X-Amz-Content-Sha256': hashlib.sha256(aws_identity_id_json).hexdigest(),
72 'X-Amz-Target': 'AWSCognitoIdentityService.GetOpenIdToken',
73 'X-Amz-User-Agent': self._AWS_USER_AGENT,
76 sts = self._download_xml(
77 'https://sts.amazonaws.com/', video_id, data=urlencode_postdata({
78 'Action': 'AssumeRoleWithWebIdentity',
79 'RoleArn': 'arn:aws:iam::710330595350:role/Cognito_WebAPIUnauth_Role',
80 'RoleSessionName': 'web-identity',
81 'Version': '2011-06-15',
82 'WebIdentityToken': token,
85 'X-Amz-User-Agent': self._AWS_USER_AGENT,
86 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
91 sts, './/{https://sts.amazonaws.com/doc/2011-06-15/}%s' % key,
94 mcp_id = self._aws_execute_api({
95 'uri': '/1/web/brands/%s/episodes/scrid/%s' % (self._SNI_TABLE[site_id], video_id),
96 'access_key': get('AccessKeyId'),
97 'secret_key': get('SecretAccessKey'),
98 'session_token': get('SessionToken'),
99 }, video_id)['results'][0]['mcpId']
101 return self.url_result(
103 'anvato:anvato_scripps_app_web_prod_0837996dbe373629133857ae9eb72e740424d80a:%s' % mcp_id,
104 {'geo_countries': ['US']}),
105 AnvatoIE.ie_key(), video_id=mcp_id)
108 class ScrippsNetworksIE(InfoExtractor):
109 _VALID_URL = r'https?://(?:www\.)?(?P<site>cookingchanneltv|discovery|(?:diy|food)network|hgtv|travelchannel)\.com/videos/[0-9a-z-]+-(?P<id>\d+)'
111 'url': 'https://www.cookingchanneltv.com/videos/the-best-of-the-best-0260338',
115 'title': 'The Best of the Best',
116 'description': 'Catch a new episode of MasterChef Canada Tuedsay at 9/8c.',
117 'timestamp': 1475678834,
118 'upload_date': '20161005',
119 'uploader': 'SCNI-SCND',
121 'add_ie': ['ThePlatform'],
123 'url': 'https://www.diynetwork.com/videos/diy-barnwood-tablet-stand-0265790',
124 'only_matching': True,
126 'url': 'https://www.foodnetwork.com/videos/chocolate-strawberry-cake-roll-7524591',
127 'only_matching': True,
129 'url': 'https://www.hgtv.com/videos/cookie-decorating-101-0301929',
130 'only_matching': True,
132 'url': 'https://www.travelchannel.com/videos/two-climates-one-bag-5302184',
133 'only_matching': True,
135 'url': 'https://www.discovery.com/videos/guardians-of-the-glades-cooking-with-tom-cobb-5578368',
136 'only_matching': True,
139 'cookingchanneltv': 2433005105,
140 'discovery': 2706091867,
141 'diynetwork': 2433004575,
142 'foodnetwork': 2433005105,
144 'travelchannel': 2433005739,
146 _TP_TEMPL = 'https://link.theplatform.com/s/ip77QC/media/guid/%d/%s?mbr=true'
148 def _real_extract(self, url):
149 site, guid = re.match(self._VALID_URL, url).groups()
150 return self.url_result(smuggle_url(
151 self._TP_TEMPL % (self._ACCOUNT_MAP[site], guid),
152 {'force_smil_url': True}), 'ThePlatform', guid)