]>
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>geniuskitchen)\.com/ 
  24                             player\.[A-Z0-9]+\.html\#| 
  31         'url': 'http://watch.geniuskitchen.com/player/3787617/Ample-Hills-Ice-Cream-Bike/', 
  35             'title': 'Ample Hills Ice Cream Bike', 
  36             'description': 'Courtney Rada churns up a signature GK Now ice cream with The Scoopmaster.', 
  38             'upload_date': '20171011', 
  39             'timestamp': 1507698000, 
  42             'skip_download': True, 
  44         'add_ie': [AnvatoIE
.ie_key()], 
  48         'geniuskitchen': 'genius', 
  51     _AWS_API_KEY 
= 'E7wSQmq0qK6xPrF13WmzKiHo4BQ7tip4pQcSXVl1' 
  52     _AWS_PROXY_HOST 
= 'web.api.video.snidigital.com' 
  54     _AWS_USER_AGENT 
= 'aws-sdk-js/2.80.0 callback' 
  56     def _real_extract(self
, url
): 
  57         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  58         site_id
, video_id 
= mobj
.group('site', 'id') 
  60         aws_identity_id_json 
= json
.dumps({ 
  61             'IdentityId': '%s:7655847c-0ae7-4d9b-80d6-56c062927eb3' % self
._AWS
_REGION
 
  63         token 
= self
._download
_json
( 
  64             'https://cognito-identity.%s.amazonaws.com/' % self
._AWS
_REGION
, video_id
, 
  65             data
=aws_identity_id_json
, 
  68                 'Content-Type': 'application/x-amz-json-1.1', 
  70                 'X-Amz-Content-Sha256': hashlib
.sha256(aws_identity_id_json
).hexdigest(), 
  71                 'X-Amz-Target': 'AWSCognitoIdentityService.GetOpenIdToken', 
  72                 'X-Amz-User-Agent': self
._AWS
_USER
_AGENT
, 
  75         sts 
= self
._download
_xml
( 
  76             'https://sts.amazonaws.com/', video_id
, data
=urlencode_postdata({ 
  77                 'Action': 'AssumeRoleWithWebIdentity', 
  78                 'RoleArn': 'arn:aws:iam::710330595350:role/Cognito_WebAPIUnauth_Role', 
  79                 'RoleSessionName': 'web-identity', 
  80                 'Version': '2011-06-15', 
  81                 'WebIdentityToken': token
, 
  84                 'X-Amz-User-Agent': self
._AWS
_USER
_AGENT
, 
  85                 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 
  90                 sts
, './/{https://sts.amazonaws.com/doc/2011-06-15/}%s' % key
, 
  93         mcp_id 
= self
._aws
_execute
_api
({ 
  94             'uri': '/1/web/brands/%s/episodes/scrid/%s' % (self
._SNI
_TABLE
[site_id
], video_id
), 
  95             'access_key': get('AccessKeyId'), 
  96             'secret_key': get('SecretAccessKey'), 
  97             'session_token': get('SessionToken'), 
  98         }, video_id
)['results'][0]['mcpId'] 
 100         return self
.url_result( 
 102                 'anvato:anvato_scripps_app_web_prod_0837996dbe373629133857ae9eb72e740424d80a:%s' % mcp_id
, 
 103                 {'geo_countries': ['US']}), 
 104             AnvatoIE
.ie_key(), video_id
=mcp_id
)