]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vube.py
fbdff471afcff7f26c203c8a895217dfb6436b41
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class VubeIE(InfoExtractor
):
12 _VALID_URL
= r
'http://vube\.com/[^/]+/(?P<id>[\da-zA-Z]{10})'
15 'url': 'http://vube.com/Chiara+Grispo+Video+Channel/YL2qNPkqon',
16 'md5': 'f81dcf6d0448e3291f54380181695821',
20 'title': 'Chiara Grispo - Price Tag by Jessie J',
21 'description': 'md5:8ea652a1f36818352428cb5134933313',
22 'thumbnail': 'http://frame.thestaticvube.com/snap/228x128/102e7e63057-5ebc-4f5c-4065-6ce4ebde131f.jpg',
23 'uploader': 'Chiara.Grispo',
24 'uploader_id': '1u3hX0znhP',
25 'upload_date': '20140103',
30 def _real_extract(self
, url
):
31 mobj
= re
.match(self
._VALID
_URL
, url
)
32 video_id
= mobj
.group('id')
34 video
= self
._download
_json
('http://vube.com/api/v2/video/%s' % video_id
,
35 video_id
, 'Downloading video JSON')
37 public_id
= video
['public_id']
39 formats
= [{'url': 'http://video.thestaticvube.com/video/%s/%s.mp4' % (fmt
['media_resolution_id'], public_id
),
40 'height': int(fmt
['height']),
41 'abr': int(fmt
['audio_bitrate']),
42 'vbr': int(fmt
['video_bitrate']),
43 'format_id': fmt
['media_resolution_id']
44 } for fmt
in video
['mtm'] if fmt
['transcoding_status'] == 'processed']
46 self
._sort
_formats
(formats
)
48 title
= video
['title']
49 description
= video
.get('description')
50 thumbnail
= video
['thumbnail_src']
51 if thumbnail
.startswith('//'):
52 thumbnail
= 'http:' + thumbnail
53 uploader
= video
['user_alias']
54 uploader_id
= video
['user_url_id']
55 upload_date
= datetime
.datetime
.fromtimestamp(int(video
['upload_time'])).strftime('%Y%m%d')
56 duration
= video
['duration']
57 view_count
= video
['raw_view_count']
58 like_count
= video
['total_likes']
59 dislike_count
= video
['total_hates']
61 comment
= self
._download
_json
('http://vube.com/api/video/%s/comment' % video_id
,
62 video_id
, 'Downloading video comment JSON')
64 comment_count
= comment
['total']
70 'description': description
,
71 'thumbnail': thumbnail
,
73 'uploader_id': uploader_id
,
74 'upload_date': upload_date
,
76 'view_count': view_count
,
77 'like_count': like_count
,
78 'dislike_count': dislike_count
,
79 'comment_count': comment_count
,