]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cwtv.py 
224a1fb5d4abcd49d3285a1aed7724d5de6a17e9
   2  from  __future__ 
import  unicode_literals
   4  from  . common 
import  InfoExtractor
  14  class  CWTVIE ( InfoExtractor
):   15      _VALID_URL 
=  r
'https?://(?:www\.)?cw(?:tv(?:pr)?|seed)\.com/(?:shows/)?(?:[^/]+/)+[^?]*\?.*\b(?:play|watch)=(?P<id>[a-z0-9] {8} -[a-z0-9] {4} -[a-z0-9] {4} -[a-z0-9] {4} -[a-z0-9] {12} )'   17          'url' :  'http://cwtv.com/shows/arrow/legends-of-yesterday/?play=6b15e985-9345-4f60-baf8-56e96be57c63' ,   19              'id' :  '6b15e985-9345-4f60-baf8-56e96be57c63' ,   21              'title' :  'Legends of Yesterday' ,   22              'description' :  'Oliver and Barry Allen take Kendra Saunders and Carter Hall to a remote location to keep them hidden from Vandal Savage while they figure out how to defeat him.' ,   28              'upload_date' :  '20151203' ,   29              'timestamp' :  1449122100 ,   33              'skip_download' :  True ,   35          'skip' :  'redirect to http://cwtv.com/shows/arrow/' ,   37          'url' :  'http://www.cwseed.com/shows/whose-line-is-it-anyway/jeff-davis-4/?play=24282b12-ead2-42f2-95ad-26770c2c6088' ,   39              'id' :  '24282b12-ead2-42f2-95ad-26770c2c6088' ,   41              'title' :  'Jeff Davis 4' ,   42              'description' :  'Jeff Davis is back to make you laugh.' ,   44              'series' :  'Whose Line Is It Anyway?' ,   47              'upload_date' :  '20151006' ,   48              'timestamp' :  1444107300 ,   54              'skip_download' :  True ,   57          'url' :  'http://cwtv.com/thecw/chroniclesofcisco/?play=8adebe35-f447-465f-ab52-e863506ff6d6' ,   58          'only_matching' :  True ,   60          'url' :  'http://cwtvpr.com/the-cw/video?watch=9eee3f60-ef4e-440b-b3b2-49428ac9c54e' ,   61          'only_matching' :  True ,   63          'url' :  'http://cwtv.com/shows/arrow/legends-of-yesterday/?watch=6b15e985-9345-4f60-baf8-56e96be57c63' ,   64          'only_matching' :  True ,   67      def  _real_extract ( self
,  url
):   68          video_id 
=  self
._ match
_ id
( url
)   69          video_data 
=  self
._ download
_ json
(   70              'http://images.cwtv.com/feed/mobileapp/video-meta/apiversion_8/guid_'  +  video_id
,   72          title 
=  video_data
[ 'title' ]   73          mpx_url 
=  video_data
. get ( 'mpx_url' )  or  'http://link.theplatform.com/s/cwtv/media/guid/2703454149/ %s ?formats=M3U'  %  video_id
  75          season 
=  str_or_none ( video_data
. get ( 'season' ))   76          episode 
=  str_or_none ( video_data
. get ( 'episode' ))   77          if  episode 
and  season
:   78              episode 
=  episode
. lstrip ( season
)   81              '_type' :  'url_transparent' ,   84              'url' :  smuggle_url ( mpx_url
, { 'force_smil_url' :  True }),   85              'description' :  video_data
. get ( 'description_long' ),   86              'duration' :  int_or_none ( video_data
. get ( 'duration_secs' )),   87              'series' :  video_data
. get ( 'series_name' ),   88              'season_number' :  int_or_none ( season
),   89              'episode_number' :  int_or_none ( episode
),   90              'timestamp' :  parse_iso8601 ( video_data
. get ( 'start_time' )),   91              'age_limit' :  parse_age_limit ( video_data
. get ( 'rating' )),   92              'ie_key' :  'ThePlatform' ,