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 'file': 'YL2qNPkqon.mp4',
17 'md5': 'f81dcf6d0448e3291f54380181695821',
19 'title': 'Chiara Grispo - Price Tag by Jessie J',
20 'description': 'md5:8ea652a1f36818352428cb5134933313',
21 'thumbnail': 'http://frame.thestaticvube.com/snap/228x128/102e7e63057-5ebc-4f5c-4065-6ce4ebde131f.jpg',
22 'uploader': 'Chiara.Grispo',
23 'uploader_id': '1u3hX0znhP',
24 'upload_date': '20140103',
29 def _real_extract(self, url):
30 mobj = re.match(self._VALID_URL, url)
31 video_id = mobj.group('id')
33 video = self._download_json('http://vube.com/api/v2/video/%s' % video_id,
34 video_id, 'Downloading video JSON')
36 public_id = video['public_id']
38 formats = [{'url': 'http://video.thestaticvube.com/video/%s/%s.mp4' % (fmt['media_resolution_id'], public_id),
39 'height': int(fmt['height']),
40 'abr': int(fmt['audio_bitrate']),
41 'vbr': int(fmt['video_bitrate']),
42 'format_id': fmt['media_resolution_id']
43 } for fmt in video['mtm'] if fmt['transcoding_status'] == 'processed']
45 self._sort_formats(formats)
47 title = video['title']
48 description = video['description']
49 thumbnail = video['thumbnail_src']
50 if thumbnail.startswith('//'):
51 thumbnail = 'http:' + thumbnail
52 uploader = video['user_alias']
53 uploader_id = video['user_url_id']
54 upload_date = datetime.datetime.fromtimestamp(int(video['upload_time'])).strftime('%Y%m%d')
55 duration = video['duration']
56 view_count = video['raw_view_count']
57 like_count = video['total_likes']
58 dislike_count= video['total_hates']
60 comment = self._download_json('http://vube.com/api/video/%s/comment' % video_id,
61 video_id, 'Downloading video comment JSON')
63 comment_count = comment['total']
69 'description': description,
70 'thumbnail': thumbnail,
72 'uploader_id': uploader_id,
73 'upload_date': upload_date,
75 'view_count': view_count,
76 'like_count': like_count,
77 'dislike_count': dislike_count,
78 'comment_count': comment_count,