]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/voot.py
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from .kaltura 
import KalturaIE
 
  14 class VootIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'https?://(?:www\.)?voot\.com/(?:[^/]+/)+(?P<id>\d+)' 
  16     _GEO_COUNTRIES 
= ['IN'] 
  18         'url': 'https://www.voot.com/shows/ishq-ka-rang-safed/1/360558/is-this-the-end-of-kamini-/441353', 
  22             'title': 'Ishq Ka Rang Safed - Season 01 - Episode 340', 
  23             'description': 'md5:06291fbbbc4dcbe21235c40c262507c1', 
  24             'uploader_id': 'batchUser', 
  25             'timestamp': 1472162937, 
  26             'upload_date': '20160825', 
  28             'series': 'Ishq Ka Rang Safed', 
  30             'episode': 'Is this the end of Kamini?', 
  31             'episode_number': 340, 
  36             'skip_download': True, 
  38         'expected_warnings': ['Failed to download m3u8 information'], 
  40         'url': 'https://www.voot.com/kids/characters/mighty-cat-masked-niyander-e-/400478/school-bag-disappears/440925', 
  41         'only_matching': True, 
  43         'url': 'https://www.voot.com/movies/pandavas-5/424627', 
  44         'only_matching': True, 
  47     def _real_extract(self
, url
): 
  48         video_id 
= self
._match
_id
(url
) 
  50         media_info 
= self
._download
_json
( 
  51             'https://wapi.voot.com/ws/ott/getMediaInfo.json', video_id
, 
  58         status_code 
= try_get(media_info
, lambda x
: x
['status']['code'], int) 
  60             raise ExtractorError(media_info
['status']['message'], expected
=True) 
  62         media 
= media_info
['assets'] 
  64         entry_id 
= media
['EntryId'] 
  65         title 
= media
['MediaName'] 
  67         description
, series
, season_number
, episode
, episode_number 
= [None] * 5 
  69         for meta 
in try_get(media
, lambda x
: x
['Metas'], list) or []: 
  70             key
, value 
= meta
.get('Key'), meta
.get('Value') 
  71             if not key 
or not value
: 
  73             if key 
== 'ContentSynopsis': 
  75             elif key 
== 'RefSeriesTitle': 
  77             elif key 
== 'RefSeriesSeason': 
  78                 season_number 
= int_or_none(value
) 
  79             elif key 
== 'EpisodeMainTitle': 
  81             elif key 
== 'EpisodeNo': 
  82                 episode_number 
= int_or_none(value
) 
  85             '_type': 'url_transparent', 
  86             'url': 'kaltura:1982551:%s' % entry_id
, 
  87             'ie_key': KalturaIE
.ie_key(), 
  89             'description': description
, 
  91             'season_number': season_number
, 
  93             'episode_number': episode_number
, 
  94             'timestamp': unified_timestamp(media
.get('CreationDate')), 
  95             'duration': int_or_none(media
.get('Duration')), 
  96             'view_count': int_or_none(media
.get('ViewCounter')), 
  97             'like_count': int_or_none(media
.get('like_counter')),