]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nowness.py
   1 from __future__ 
import unicode_literals
 
   5 from .brightcove 
import BrightcoveIE
 
   6 from .common 
import InfoExtractor
 
  12 class NownessIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://(?:www\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])' 
  16         'url': 'http://www.nowness.com/day/2013/6/27/3131/candor--the-art-of-gesticulation', 
  17         'file': '2520295746001.mp4', 
  18         'md5': '0ece2f70a7bd252c7b00f3070182d418', 
  20             'description': 'Candor: The Art of Gesticulation', 
  21             'uploader': 'Nowness', 
  22             'title': 'Candor: The Art of Gesticulation', 
  26     def _real_extract(self
, url
): 
  27         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  28         video_id 
= mobj
.group('slug') 
  30         webpage 
= self
._download
_webpage
(url
, video_id
) 
  31         player_url 
= self
._search
_regex
( 
  32             r
'"([^"]+/content/issue-[0-9.]+.js)"', webpage
, 'player URL') 
  33         real_id 
= self
._search
_regex
( 
  34             r
'\sdata-videoId="([0-9]+)"', webpage
, 'internal video ID') 
  36         player_code 
= self
._download
_webpage
( 
  38             note
='Downloading player JavaScript', 
  39             errnote
='Player download failed') 
  40         player_code 
= player_code
.replace("'+d+'", real_id
) 
  42         bc_url 
= BrightcoveIE
._extract
_brightcove
_url
(player_code
) 
  44             raise ExtractorError('Could not find player definition') 
  48             'ie_key': 'Brightcove',