]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/scrippsnetworks.py
2 from __future__
import unicode_literals
9 from .anvato
import AnvatoIE
17 class ScrippsNetworksWatchIE(AWSIE
):
18 IE_NAME
= 'scrippsnetworks:watch'
22 (?P<site>hgtv|foodnetwork|travelchannel|diynetwork|cookingchanneltv|geniuskitchen)\.com/
24 player\.[A-Z0-9]+\.html\#|
31 'url': 'http://watch.hgtv.com/show/HGTVE/Best-Ever-Treehouses/2241515/Best-Ever-Treehouses/',
32 'md5': '26545fd676d939954c6808274bdb905a',
36 'title': 'Best Ever Treehouses',
37 'description': "We're searching for the most over the top treehouses.",
39 'upload_date': '20170922',
40 'timestamp': 1506056400,
43 'skip_download': True,
45 'add_ie': [AnvatoIE
.ie_key()],
47 'url': 'http://watch.diynetwork.com/show/DSAL/Salvage-Dawgs/2656646/Covington-Church/',
48 'only_matching': True,
50 'url': 'http://watch.diynetwork.com/player.HNT.html#2656646',
51 'only_matching': True,
53 'url': 'http://watch.geniuskitchen.com/player/3787617/Ample-Hills-Ice-Cream-Bike/',
54 'only_matching': True,
60 'foodnetwork': 'food',
61 'cookingchanneltv': 'cook',
62 'travelchannel': 'trav',
63 'geniuskitchen': 'genius',
66 _AWS_API_KEY
= 'E7wSQmq0qK6xPrF13WmzKiHo4BQ7tip4pQcSXVl1'
67 _AWS_PROXY_HOST
= 'web.api.video.snidigital.com'
69 _AWS_USER_AGENT
= 'aws-sdk-js/2.80.0 callback'
71 def _real_extract(self
, url
):
72 mobj
= re
.match(self
._VALID
_URL
, url
)
73 site_id
, video_id
= mobj
.group('site', 'id')
75 aws_identity_id_json
= json
.dumps({
76 'IdentityId': '%s:7655847c-0ae7-4d9b-80d6-56c062927eb3' % self
._AWS
_REGION
78 token
= self
._download
_json
(
79 'https://cognito-identity.%s.amazonaws.com/' % self
._AWS
_REGION
, video_id
,
80 data
=aws_identity_id_json
,
83 'Content-Type': 'application/x-amz-json-1.1',
85 'X-Amz-Content-Sha256': hashlib
.sha256(aws_identity_id_json
).hexdigest(),
86 'X-Amz-Target': 'AWSCognitoIdentityService.GetOpenIdToken',
87 'X-Amz-User-Agent': self
._AWS
_USER
_AGENT
,
90 sts
= self
._download
_xml
(
91 'https://sts.amazonaws.com/', video_id
, data
=urlencode_postdata({
92 'Action': 'AssumeRoleWithWebIdentity',
93 'RoleArn': 'arn:aws:iam::710330595350:role/Cognito_WebAPIUnauth_Role',
94 'RoleSessionName': 'web-identity',
95 'Version': '2011-06-15',
96 'WebIdentityToken': token
,
99 'X-Amz-User-Agent': self
._AWS
_USER
_AGENT
,
100 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
105 sts
, './/{https://sts.amazonaws.com/doc/2011-06-15/}%s' % key
,
108 mcp_id
= self
._aws
_execute
_api
({
109 'uri': '/1/web/brands/%s/episodes/scrid/%s' % (self
._SNI
_TABLE
[site_id
], video_id
),
110 'access_key': get('AccessKeyId'),
111 'secret_key': get('SecretAccessKey'),
112 'session_token': get('SessionToken'),
113 }, video_id
)['results'][0]['mcpId']
115 return self
.url_result(
117 'anvato:anvato_scripps_app_web_prod_0837996dbe373629133857ae9eb72e740424d80a:%s' % mcp_id
,
118 {'geo_countries': ['US']}),
119 AnvatoIE
.ie_key(), video_id
=mcp_id
)