]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/viddler.py
0faa729c60f916d69b885cfc76580104b226f84b
1 from __future__
import unicode_literals
3 from . common
import InfoExtractor
10 class ViddlerIE ( InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?viddler\.com/(?:v|embed|player)/(?P<id>[a-z0-9]+)'
13 "url" : "http://www.viddler.com/v/43903784" ,
14 'md5' : 'ae43ad7cb59431ce043f0ff7fa13cbf4' ,
18 "title" : "Video Made Easy" ,
19 'description' : 'You don \' t need to be a professional to make high-quality video content. Viddler provides some quick and easy tips on how to produce great video content with limited resources. ' ,
20 "uploader" : "viddler" ,
21 'timestamp' : 1335371429 ,
22 'upload_date' : '20120425' ,
24 'thumbnail' : 're:^https?://.*\.jpg$' ,
26 'categories' : [ 'video content' , 'high quality video' , 'video made easy' , 'how to produce video with limited resources' , 'viddler' ],
30 def _real_extract ( self
, url
):
31 video_id
= self
._ match
_ id
( url
)
34 'http://api.viddler.com/api/v2/viddler.videos.getPlaybackDetails.json?video_id= %s &key=v0vhrt7bg2xq1vyxhkct' %
36 data
= self
._ download
_ json
( json_url
, video_id
)[ 'video' ]
39 for filed
in data
[ 'files' ]:
40 if filed
. get ( 'status' , 'ready' ) != 'ready' :
43 'format_id' : filed
[ 'profile_id' ],
44 'format_note' : filed
[ 'profile_name' ],
45 'url' : self
._ proto
_ relative
_u rl
( filed
[ 'url' ]),
46 'width' : int_or_none ( filed
. get ( 'width' )),
47 'height' : int_or_none ( filed
. get ( 'height' )),
48 'filesize' : int_or_none ( filed
. get ( 'size' )),
49 'ext' : filed
. get ( 'ext' ),
50 'source_preference' : - 1 ,
54 if filed
. get ( 'cdn_url' ):
56 f
[ 'url' ] = self
._ proto
_ relative
_u rl
( filed
[ 'cdn_url' ])
57 f
[ 'format_id' ] = filed
[ 'profile_id' ] + '-cdn'
58 f
[ 'source_preference' ] = 1
61 if filed
. get ( 'html5_video_source' ):
63 f
[ 'url' ] = self
._ proto
_ relative
_u rl
(
64 filed
[ 'html5_video_source' ])
65 f
[ 'format_id' ] = filed
[ 'profile_id' ] + '-html5'
66 f
[ 'source_preference' ] = 0
68 self
._ sort
_ formats
( formats
)
71 t
. get ( 'text' ) for t
in data
. get ( 'tags' , []) if 'text' in t
]
76 'title' : data
[ 'title' ],
78 'description' : data
. get ( 'description' ),
79 'timestamp' : int_or_none ( data
. get ( 'upload_time' )),
80 'thumbnail' : self
._ proto
_ relative
_u rl
( data
. get ( 'thumbnail_url' )),
81 'uploader' : data
. get ( 'author' ),
82 'duration' : float_or_none ( data
. get ( 'length' )),
83 'view_count' : int_or_none ( data
. get ( 'view_count' )),
84 'categories' : categories
,