]>
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
 
   7 from ..utils 
import ExtractorError
 
  10 class NownessIE(InfoExtractor
): 
  11     _VALID_URL 
= r
'https?://(?:www\.)?nowness\.com/[^?#]*?/(?P<id>[0-9]+)/(?P<slug>[^/]+?)(?:$|[?#])' 
  14         'url': 'http://www.nowness.com/day/2013/6/27/3131/candor--the-art-of-gesticulation', 
  15         'md5': '068bc0202558c2e391924cb8cc470676', 
  17             'id': '2520295746001', 
  19             'description': 'Candor: The Art of Gesticulation', 
  20             'uploader': 'Nowness', 
  21             'title': 'Candor: The Art of Gesticulation', 
  25     def _real_extract(self
, url
): 
  26         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  27         video_id 
= mobj
.group('slug') 
  29         webpage 
= self
._download
_webpage
(url
, video_id
) 
  30         player_url 
= self
._search
_regex
( 
  31             r
'"([^"]+/content/issue-[0-9.]+.js)"', webpage
, 'player URL') 
  32         real_id 
= self
._search
_regex
( 
  33             r
'\sdata-videoId="([0-9]+)"', webpage
, 'internal video ID') 
  35         player_code 
= self
._download
_webpage
( 
  37             note
='Downloading player JavaScript', 
  38             errnote
='Player download failed') 
  39         player_code 
= player_code
.replace("'+d+'", real_id
) 
  41         bc_url 
= BrightcoveIE
._extract
_brightcove
_url
(player_code
) 
  43             raise ExtractorError('Could not find player definition') 
  47             'ie_key': 'Brightcove',