]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/sprout.py
   2 from __future__ 
import unicode_literals
 
   4 from .adobepass 
import AdobePassIE
 
  12 class SproutIE(AdobePassIE
): 
  13     _VALID_URL 
= r
'https?://(?:www\.)?sproutonline\.com/watch/(?P<id>[^/?#]+)' 
  15         'url': 'http://www.sproutonline.com/watch/cowboy-adventure', 
  16         'md5': '74bf14128578d1e040c3ebc82088f45f', 
  20             'title': 'A Cowboy Adventure', 
  21             'description': 'Ruff-Ruff, Tweet and Dave get to be cowboys for the day at Six Cow Corral.', 
  22             'timestamp': 1437758640, 
  23             'upload_date': '20150724', 
  24             'uploader': 'NBCU-SPROUT-NEW', 
  28     def _real_extract(self
, url
): 
  29         video_id 
= self
._match
_id
(url
) 
  30         webpage 
= self
._download
_webpage
(url
, video_id
) 
  31         video_component 
= self
._search
_regex
( 
  32             r
'(?s)(<div[^>]+data-component="video"[^>]*?>)', 
  33             webpage
, 'video component', default
=None) 
  35             options 
= self
._parse
_json
(extract_attributes( 
  36                 video_component
)['data-options'], video_id
) 
  37             theplatform_url 
= options
['video'] 
  42             if options
.get('protected'): 
  43                 query
['auth'] = self
._extract
_mvpd
_auth
(url
, options
['pid'], 'sprout', 'sprout') 
  44             theplatform_url 
= smuggle_url(update_url_query( 
  45                 theplatform_url
, query
), {'force_smil_url': True}) 
  47             iframe 
= self
._search
_regex
( 
  48                 r
'(<iframe[^>]+id="sproutVideoIframe"[^>]*?>)', 
  50             theplatform_url 
= extract_attributes(iframe
)['src'] 
  52         return self
.url_result(theplatform_url
, 'ThePlatform')