]>
 
 
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cwtv.py 
 
 
 
 
 
 
 
 
   2  from  __future__ 
import  unicode_literals
 
   4  from  . common 
import  InfoExtractor
 
  15  class  CWTVIE ( InfoExtractor
):  
  16      _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} )'  
  18          'url' :  'http://cwtv.com/shows/arrow/legends-of-yesterday/?play=6b15e985-9345-4f60-baf8-56e96be57c63' ,  
  20              'id' :  '6b15e985-9345-4f60-baf8-56e96be57c63' ,  
  22              'title' :  'Legends of Yesterday' ,  
  23              '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.' ,  
  29              'upload_date' :  '20151203' ,  
  30              'timestamp' :  1449122100 ,  
  34              'skip_download' :  True ,  
  36          'skip' :  'redirect to http://cwtv.com/shows/arrow/' ,  
  38          'url' :  'http://www.cwseed.com/shows/whose-line-is-it-anyway/jeff-davis-4/?play=24282b12-ead2-42f2-95ad-26770c2c6088' ,  
  40              'id' :  '24282b12-ead2-42f2-95ad-26770c2c6088' ,  
  42              'title' :  'Jeff Davis 4' ,  
  43              'description' :  'Jeff Davis is back to make you laugh.' ,  
  45              'series' :  'Whose Line Is It Anyway?' ,  
  48              'upload_date' :  '20151006' ,  
  49              'timestamp' :  1444107300 ,  
  55              'skip_download' :  True ,  
  58          'url' :  'http://cwtv.com/thecw/chroniclesofcisco/?play=8adebe35-f447-465f-ab52-e863506ff6d6' ,  
  59          'only_matching' :  True ,  
  61          'url' :  'http://cwtvpr.com/the-cw/video?watch=9eee3f60-ef4e-440b-b3b2-49428ac9c54e' ,  
  62          'only_matching' :  True ,  
  64          'url' :  'http://cwtv.com/shows/arrow/legends-of-yesterday/?watch=6b15e985-9345-4f60-baf8-56e96be57c63' ,  
  65          'only_matching' :  True ,  
  68      def  _real_extract ( self
,  url
):  
  69          video_id 
=  self
._ match
_ id
( url
)  
  70          data 
=  self
._ download
_ json
(  
  71              'http://images.cwtv.com/feed/mobileapp/video-meta/apiversion_8/guid_'  +  video_id
,  
  73          if  data
. get ( 'result' ) !=  'ok' :  
  74              raise  ExtractorError ( data
[ 'msg' ],  expected
= True )  
  75          video_data 
=  data
[ 'video' ]  
  76          title 
=  video_data
[ 'title' ]  
  77          mpx_url 
=  video_data
. get ( 'mpx_url' )  or  'http://link.theplatform.com/s/cwtv/media/guid/2703454149/ %s ?formats=M3U'  %  video_id
 
  79          season 
=  str_or_none ( video_data
. get ( 'season' ))  
  80          episode 
=  str_or_none ( video_data
. get ( 'episode' ))  
  81          if  episode 
and  season
:  
  82              episode 
=  episode
. lstrip ( season
)  
  85              '_type' :  'url_transparent' ,  
  88              'url' :  smuggle_url ( mpx_url
, { 'force_smil_url' :  True }),  
  89              'description' :  video_data
. get ( 'description_long' ),  
  90              'duration' :  int_or_none ( video_data
. get ( 'duration_secs' )),  
  91              'series' :  video_data
. get ( 'series_name' ),  
  92              'season_number' :  int_or_none ( season
),  
  93              'episode_number' :  int_or_none ( episode
),  
  94              'timestamp' :  parse_iso8601 ( video_data
. get ( 'start_time' )),  
  95              'age_limit' :  parse_age_limit ( video_data
. get ( 'rating' )),  
  96              'ie_key' :  'ThePlatform' ,