]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/crackle.py
2 from __future__
import unicode_literals
, division
6 from . common
import InfoExtractor
7 from .. utils
import int_or_none
10 class CrackleIE ( InfoExtractor
):
11 _VALID_URL
= r
'(?:crackle:|https?://(?:www\.)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
13 'url' : 'http://www.crackle.com/comedians-in-cars-getting-coffee/2498934' ,
17 'title' : 'Everybody Respects A Bloody Nose' ,
18 'description' : 'Jerry is kaffeeklatsching in L.A. with funnyman J.B. Smoove (Saturday Night Live, Real Husbands of Hollywood). They’re headed for brew at 10 Speed Coffee in a 1964 Studebaker Avanti.' ,
19 'thumbnail' : 're:^https?://.*\.jpg' ,
21 'series' : 'Comedians In Cars Getting Coffee' ,
32 'skip_download' : True ,
36 # extracted from http://legacyweb-us.crackle.com/flash/ReferrerRedirect.ashx
56 def _real_extract ( self
, url
):
57 video_id
= self
._ match
_ id
( url
)
59 config_doc
= self
._ download
_ xml
(
60 'http://legacyweb-us.crackle.com/flash/QueryReferrer.ashx?site=16' ,
61 video_id
, 'Downloading config' )
63 item
= self
._ download
_ xml
(
64 'http://legacyweb-us.crackle.com/app/revamp/vidwallcache.aspx?flags=-1&fm= %s ' % video_id
,
66 title
= item
. attrib
[ 't' ]
69 formats
= self
._ extract
_ m
3u8_ formats
(
70 'http://content.uplynk.com/ext/ %s / %s .m3u8' % ( config_doc
. attrib
[ 'strUplynkOwnerId' ], video_id
),
71 video_id
, 'mp4' , m3u8_id
= 'hls' , fatal
= None )
72 path
= item
. attrib
. get ( 'p' )
74 http_base_url
= 'http://ahttp.crackle.com/' + path
75 for mfs_path
, mfs_info
in self
._ MEDIA
_ FILE
_ SLOTS
. items ():
77 'url' : http_base_url
+ mfs_path
,
78 'format_id' : 'http-' + mfs_path
. split ( '.' )[ 0 ],
79 'width' : mfs_info
[ 'width' ],
80 'height' : mfs_info
[ 'height' ],
82 for cc
in item
. findall ( 'cc' ):
83 locale
= cc
. attrib
. get ( 'l' )
84 v
= cc
. attrib
. get ( 'v' )
86 if locale
not in subtitles
:
87 subtitles
[ locale
] = []
88 subtitles
[ locale
] = [{
89 'url' : ' %s / %s%s _ %s .xml' % ( config_doc
. attrib
[ 'strSubtitleServer' ], path
, locale
, v
),
92 self
._ sort
_ formats
( formats
, ( 'width' , 'height' , 'tbr' , 'format_id' ))
94 media_details
= self
._ download
_ json
(
95 'https://web-api-us.crackle.com/Service.svc/details/media/ %s /TW?format=json' % video_id
,
96 video_id
, fatal
= False )
99 for key
, value
in media_details
. items ():
100 mobj
= re
. match ( '^Thumbnail_(\d+)x(\d+)$' , key
)
102 width
, height
= list ( map ( int , mobj
. groups ()))
104 'id' : ' %d p' % height
,
113 'description' : item
. attrib
. get ( 'd' ),
114 'duration' : int ( item
. attrib
. get ( 'r' ), 16 ) / 1000 if item
. attrib
. get ( 'r' ) else None ,
115 'series' : item
. attrib
. get ( 'sn' ),
116 'season_number' : int_or_none ( item
. attrib
. get ( 'se' )),
117 'episode_number' : int_or_none ( item
. attrib
. get ( 'ep' )),
118 'thumbnails' : thumbnails
,
119 'subtitles' : subtitles
,