]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/usanetwork.py
   2 from __future__ 
import unicode_literals
 
   4 from .adobepass 
import AdobePassIE
 
  12 class USANetworkIE(AdobePassIE
): 
  13     _VALID_URL 
= r
'https?://(?:www\.)?usanetwork\.com/(?:[^/]+/videos|movies)/(?P<id>[^/?#]+)' 
  15         'url': 'http://www.usanetwork.com/mrrobot/videos/hpe-cybersecurity', 
  16         'md5': '33c0d2ba381571b414024440d08d57fd', 
  20             'title': 'HPE Cybersecurity', 
  21             'description': 'The more we digitize our world, the more vulnerable we are.', 
  22             'upload_date': '20160818', 
  23             'timestamp': 1471535460, 
  24             'uploader': 'NBCU-USA', 
  28     def _real_extract(self
, url
): 
  29         display_id 
= self
._match
_id
(url
) 
  30         webpage 
= self
._download
_webpage
(url
, display_id
) 
  32         def _x(name
, default
=NO_DEFAULT
): 
  33             return self
._search
_regex
( 
  34                 r
'data-%s\s*=\s*(["\'])(?P
<value
>(?
:(?
!\
1).)+)\
1' % name, 
  35                 webpage, name, default=default, group='value
') 
  37         video_id = _x('mpx
-guid
') 
  38         title = _x('episode
-title
') 
  39         mpx_account_id = _x('mpx
-account
-id', '2304992029') 
  44         if _x('is-full
-episode
', None) == '1': 
  45             query['manifest
'] = 'm3u
' 
  47         if _x('is-entitlement
', None) == '1': 
  49             drupal_settings = self._search_regex( 
  50                 r'jQuery\
.extend\
(Drupal\
.settings\s
*,\s
*({.+?
})\
);', 
  51                 webpage, 'drupal settings
', fatal=False) 
  53                 drupal_settings = self._parse_json(drupal_settings, video_id, fatal=False) 
  55                     adobe_pass = drupal_settings.get('adobePass
', {}) 
  56             resource = self._get_mvpd_resource( 
  57                 adobe_pass.get('adobePassResourceId
', 'usa
'), 
  58                 title, video_id, _x('episode
-rating
', 'TV
-14')) 
  59             query['auth
'] = self._extract_mvpd_auth( 
  60                 url, video_id, adobe_pass.get('adobePassRequestorId
', 'usa
'), resource) 
  62         info = self._search_json_ld(webpage, video_id, default={}) 
  64             '_type
': 'url_transparent
', 
  65             'url
': smuggle_url(update_url_query( 
  66                 'http
://link
.theplatform
.com
/s
/HNK2IC
/media
/guid
/%s/%s' % (mpx_account_id, video_id), 
  67                 query), {'force_smil_url
': True}), 
  70             'series
': _x('show
-title
', None), 
  72             'ie_key
': 'ThePlatform
',