]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cwtv.py
2 from __future__
import unicode_literals
4 from . common
import InfoExtractor
11 class CWTVIE ( InfoExtractor
):
12 _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} )'
14 'url' : 'http://cwtv.com/shows/arrow/legends-of-yesterday/?play=6b15e985-9345-4f60-baf8-56e96be57c63' ,
16 'id' : '6b15e985-9345-4f60-baf8-56e96be57c63' ,
18 'title' : 'Legends of Yesterday' ,
19 '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.' ,
25 'upload_date' : '20151203' ,
26 'timestamp' : 1449122100 ,
30 'skip_download' : True ,
32 'skip' : 'redirect to http://cwtv.com/shows/arrow/' ,
34 'url' : 'http://www.cwseed.com/shows/whose-line-is-it-anyway/jeff-davis-4/?play=24282b12-ead2-42f2-95ad-26770c2c6088' ,
36 'id' : '24282b12-ead2-42f2-95ad-26770c2c6088' ,
38 'title' : 'Jeff Davis 4' ,
39 'description' : 'Jeff Davis is back to make you laugh.' ,
41 'series' : 'Whose Line Is It Anyway?' ,
45 'upload_date' : '20151006' ,
46 'timestamp' : 1444107300 ,
49 'url' : 'http://cwtv.com/thecw/chroniclesofcisco/?play=8adebe35-f447-465f-ab52-e863506ff6d6' ,
50 'only_matching' : True ,
52 'url' : 'http://cwtvpr.com/the-cw/video?watch=9eee3f60-ef4e-440b-b3b2-49428ac9c54e' ,
53 'only_matching' : True ,
55 'url' : 'http://cwtv.com/shows/arrow/legends-of-yesterday/?watch=6b15e985-9345-4f60-baf8-56e96be57c63' ,
56 'only_matching' : True ,
59 def _real_extract ( self
, url
):
60 video_id
= self
._ match
_ id
( url
)
63 for partner
in ( 154 , 213 ):
64 vdata
= self
._ download
_ json
(
65 'http://metaframe.digitalsmiths.tv/v2/CWtv/assets/ %s /partner/ %d ?format=json' % ( video_id
, partner
), video_id
, fatal
= False )
69 for quality
, quality_data
in vdata
. get ( 'videos' , {}). items ():
70 quality_url
= quality_data
. get ( 'uri' )
73 if quality
== 'variantplaylist' :
74 formats
. extend ( self
._ extract
_ m
3u8_ formats
(
75 quality_url
, video_id
, 'mp4' , m3u8_id
= 'hls' , fatal
= False ))
77 tbr
= int_or_none ( quality_data
. get ( 'bitrate' ))
78 format_id
= 'http' + ( '- %d ' % tbr
if tbr
else '' )
79 if self
._ is
_ valid
_u rl
( quality_url
, video_id
, format_id
):
81 'format_id' : format_id
,
85 self
._ sort
_ formats
( formats
)
89 'width' : image
. get ( 'width' ),
90 'height' : image
. get ( 'height' ),
91 } for image_id
, image
in video_data
[ 'images' ]. items () if image
. get ( 'uri' )] if video_data
. get ( 'images' ) else None
93 video_metadata
= video_data
[ 'assetFields' ]
97 'url' : video_metadata
[ 'UnicornCcUrl' ],
99 } if video_metadata
. get ( 'UnicornCcUrl' ) else None
103 'title' : video_metadata
[ 'title' ],
104 'description' : video_metadata
. get ( 'description' ),
105 'duration' : int_or_none ( video_metadata
. get ( 'duration' )),
106 'series' : video_metadata
. get ( 'seriesName' ),
107 'season_number' : int_or_none ( video_metadata
. get ( 'seasonNumber' )),
108 'season' : video_metadata
. get ( 'seasonName' ),
109 'episode_number' : int_or_none ( video_metadata
. get ( 'episodeNumber' )),
110 'timestamp' : parse_iso8601 ( video_data
. get ( 'startTime' )),
111 'thumbnails' : thumbnails
,
113 'subtitles' : subtitles
,