]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ellentv.py
   2 from __future__ 
import unicode_literals
 
   6 from .common 
import InfoExtractor
 
  12 class EllenTVIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://(?:www\.)?(?:ellentv|ellentube)\.com/videos/(?P<id>[a-z0-9_-]+)' 
  15         'url': 'http://www.ellentv.com/videos/0-ipq1gsai/', 
  16         'md5': '4294cf98bc165f218aaa0b89e0fd8042', 
  20             'title': 'Fast Fingers of Fate', 
  21             'description': 'md5:3539013ddcbfa64b2a6d1b38d910868a', 
  22             'timestamp': 1428035648, 
  23             'upload_date': '20150403', 
  24             'uploader_id': 'batchUser', 
  28     def _real_extract(self
, url
): 
  29         video_id 
= self
._match
_id
(url
) 
  31         webpage 
= self
._download
_webpage
( 
  32             'http://widgets.ellentube.com/videos/%s' % video_id
, 
  35         partner_id 
= self
._search
_regex
( 
  36             r
"var\s+partnerId\s*=\s*'([^']+)", webpage
, 'partner id') 
  38         kaltura_id 
= self
._search
_regex
( 
  39             [r
'id="kaltura_player_([^"]+)"', 
  40              r
"_wb_entry_id\s*:\s*'([^']+)", 
  41              r
'data-kaltura-entry-id="([^"]+)'], 
  42             webpage
, 'kaltura id') 
  44         return self
.url_result('kaltura:%s:%s' % (partner_id
, kaltura_id
), 'Kaltura') 
  47 class EllenTVClipsIE(InfoExtractor
): 
  48     IE_NAME 
= 'EllenTV:clips' 
  49     _VALID_URL 
= r
'https?://(?:www\.)?ellentv\.com/episodes/(?P<id>[a-z0-9_-]+)' 
  51         'url': 'http://www.ellentv.com/episodes/meryl-streep-vanessa-hudgens/', 
  53             'id': 'meryl-streep-vanessa-hudgens', 
  54             'title': 'Meryl Streep, Vanessa Hudgens', 
  56         'playlist_mincount': 7, 
  59     def _real_extract(self
, url
): 
  60         playlist_id 
= self
._match
_id
(url
) 
  62         webpage 
= self
._download
_webpage
(url
, playlist_id
) 
  63         playlist 
= self
._extract
_playlist
(webpage
) 
  68             'title': self
._og
_search
_title
(webpage
), 
  69             'entries': self
._extract
_entries
(playlist
) 
  72     def _extract_playlist(self
, webpage
): 
  73         json_string 
= self
._search
_regex
(r
'playerView.addClips\(\[\{(.*?)\}\]\);', webpage
, 'json') 
  75             return json
.loads('[{' + json_string 
+ '}]') 
  76         except ValueError as ve
: 
  77             raise ExtractorError('Failed to download JSON', cause
=ve
) 
  79     def _extract_entries(self
, playlist
): 
  82                 'kaltura:%s:%s' % (item
['kaltura_partner_id'], item
['kaltura_entry_id']),