]>
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 _GEO_COUNTRIES
= [ 'US' ]
10 _VALID_URL
= r
'(?:crackle:|https?://(?:(?:www|m)\.)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
12 'url' : 'http://www.crackle.com/comedians-in-cars-getting-coffee/2498934' ,
16 'title' : 'Everybody Respects A Bloody Nose' ,
17 '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.' ,
18 'thumbnail' : r
're:^https?://.*\.jpg' ,
20 'series' : 'Comedians In Cars Getting Coffee' ,
31 'skip_download' : True ,
60 # extracted from http://legacyweb-us.crackle.com/flash/ReferrerRedirect.ashx
80 def _real_extract ( self
, url
):
81 video_id
= self
._ match
_ id
( url
)
83 config_doc
= self
._ download
_ xml
(
84 'http://legacyweb-us.crackle.com/flash/QueryReferrer.ashx?site=16' ,
85 video_id
, 'Downloading config' )
87 item
= self
._ download
_ xml
(
88 'http://legacyweb-us.crackle.com/app/revamp/vidwallcache.aspx?flags=-1&fm= %s ' % video_id
,
89 video_id
, headers
= self
. geo_verification_headers ()). find ( 'i' )
90 title
= item
. attrib
[ 't' ]
93 formats
= self
._ extract
_ m
3u8_ formats
(
94 'http://content.uplynk.com/ext/ %s / %s .m3u8' % ( config_doc
. attrib
[ 'strUplynkOwnerId' ], video_id
),
95 video_id
, 'mp4' , m3u8_id
= 'hls' , fatal
= None )
97 path
= item
. attrib
. get ( 'p' )
99 for width
, height
in self
._ THUMBNAIL
_ RES
:
100 res
= ' %dx%d ' % ( width
, height
)
103 'url' : 'http://images-us-am.crackle.com/ %s tnl_ %s .jpg' % ( path
, res
),
108 http_base_url
= 'http://ahttp.crackle.com/' + path
109 for mfs_path
, mfs_info
in self
._ MEDIA
_ FILE
_ SLOTS
. items ():
111 'url' : http_base_url
+ mfs_path
,
112 'format_id' : 'http-' + mfs_path
. split ( '.' )[ 0 ],
113 'width' : mfs_info
[ 'width' ],
114 'height' : mfs_info
[ 'height' ],
116 for cc
in item
. findall ( 'cc' ):
117 locale
= cc
. attrib
. get ( 'l' )
118 v
= cc
. attrib
. get ( 'v' )
120 if locale
not in subtitles
:
121 subtitles
[ locale
] = []
122 for url_ext
, ext
in (( 'vtt' , 'vtt' ), ( 'xml' , 'tt' )):
123 subtitles
. setdefault ( locale
, []). append ({
124 'url' : ' %s / %s%s _ %s . %s ' % ( config_doc
. attrib
[ 'strSubtitleServer' ], path
, locale
, v
, url_ext
),
127 self
._ sort
_ formats
( formats
, ( 'width' , 'height' , 'tbr' , 'format_id' ))
132 'description' : item
. attrib
. get ( 'd' ),
133 'duration' : int ( item
. attrib
. get ( 'r' ), 16 ) / 1000 if item
. attrib
. get ( 'r' ) else None ,
134 'series' : item
. attrib
. get ( 'sn' ),
135 'season_number' : int_or_none ( item
. attrib
. get ( 'se' )),
136 'episode_number' : int_or_none ( item
. attrib
. get ( 'ep' )),
137 'thumbnails' : thumbnails
,
138 'subtitles' : subtitles
,