]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/crackle.py
2 from __future__
import unicode_literals
, division
4 from . common
import InfoExtractor
5 from .. utils
import int_or_none
8 class CrackleIE ( InfoExtractor
):
9 _VALID_URL
= r
'(?:crackle:|https?://(?:(?:www|m)\.)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
11 'url' : 'http://www.crackle.com/comedians-in-cars-getting-coffee/2498934' ,
15 'title' : 'Everybody Respects A Bloody Nose' ,
16 '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.' ,
17 'thumbnail' : r
're:^https?://.*\.jpg' ,
19 'series' : 'Comedians In Cars Getting Coffee' ,
30 'skip_download' : True ,
59 # extracted from http://legacyweb-us.crackle.com/flash/ReferrerRedirect.ashx
79 def _real_extract ( self
, url
):
80 video_id
= self
._ match
_ id
( url
)
82 config_doc
= self
._ download
_ xml
(
83 'http://legacyweb-us.crackle.com/flash/QueryReferrer.ashx?site=16' ,
84 video_id
, 'Downloading config' )
86 item
= self
._ download
_ xml
(
87 'http://legacyweb-us.crackle.com/app/revamp/vidwallcache.aspx?flags=-1&fm= %s ' % video_id
,
88 video_id
, headers
= self
. geo_verification_headers ()). find ( 'i' )
89 title
= item
. attrib
[ 't' ]
92 formats
= self
._ extract
_ m
3u8_ formats
(
93 'http://content.uplynk.com/ext/ %s / %s .m3u8' % ( config_doc
. attrib
[ 'strUplynkOwnerId' ], video_id
),
94 video_id
, 'mp4' , m3u8_id
= 'hls' , fatal
= None )
96 path
= item
. attrib
. get ( 'p' )
98 for width
, height
in self
._ THUMBNAIL
_ RES
:
99 res
= ' %dx%d ' % ( width
, height
)
102 'url' : 'http://images-us-am.crackle.com/ %s tnl_ %s .jpg' % ( path
, res
),
107 http_base_url
= 'http://ahttp.crackle.com/' + path
108 for mfs_path
, mfs_info
in self
._ MEDIA
_ FILE
_ SLOTS
. items ():
110 'url' : http_base_url
+ mfs_path
,
111 'format_id' : 'http-' + mfs_path
. split ( '.' )[ 0 ],
112 'width' : mfs_info
[ 'width' ],
113 'height' : mfs_info
[ 'height' ],
115 for cc
in item
. findall ( 'cc' ):
116 locale
= cc
. attrib
. get ( 'l' )
117 v
= cc
. attrib
. get ( 'v' )
119 if locale
not in subtitles
:
120 subtitles
[ locale
] = []
121 for url_ext
, ext
in (( 'vtt' , 'vtt' ), ( 'xml' , 'tt' )):
122 subtitles
. setdefault ( locale
, []). append ({
123 'url' : ' %s / %s%s _ %s . %s ' % ( config_doc
. attrib
[ 'strSubtitleServer' ], path
, locale
, v
, url_ext
),
126 self
._ sort
_ formats
( formats
, ( 'width' , 'height' , 'tbr' , 'format_id' ))
131 'description' : item
. attrib
. get ( 'd' ),
132 'duration' : int ( item
. attrib
. get ( 'r' ), 16 ) / 1000 if item
. attrib
. get ( 'r' ) else None ,
133 'series' : item
. attrib
. get ( 'sn' ),
134 'season_number' : int_or_none ( item
. attrib
. get ( 'se' )),
135 'episode_number' : int_or_none ( item
. attrib
. get ( 'ep' )),
136 'thumbnails' : thumbnails
,
137 'subtitles' : subtitles
,