1 from __future__ import unicode_literals
5 from .common import InfoExtractor
8 class VubeIE(InfoExtractor):
11 _VALID_URL = r'http://vube\.com/(?:[^/]+/)+(?P<id>[\da-zA-Z]{10})\b'
15 'url': 'http://vube.com/Chiara+Grispo+Video+Channel/YL2qNPkqon',
16 'md5': 'db7aba89d4603dadd627e9d1973946fe',
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 'timestamp': 1388743358,
26 'upload_date': '20140103',
31 'url': 'http://vube.com/SerainaMusic/my-7-year-old-sister-and-i-singing-alive-by-krewella/UeBhTudbfS?t=s&n=1',
32 'md5': '5d4a52492d76f72712117ce6b0d98d08',
36 'title': 'My 7 year old Sister and I singing "Alive" by Krewella',
37 'description': 'md5:40bcacb97796339f1690642c21d56f4a',
38 'thumbnail': 'http://frame.thestaticvube.com/snap/228x128/102265d5a9f-0f17-4f6b-5753-adf08484ee1e.jpg',
39 'uploader': 'Seraina',
40 'uploader_id': 'XU9VE2BQ2q',
41 'timestamp': 1396492438,
42 'upload_date': '20140403',
48 def _real_extract(self, url):
49 mobj = re.match(self._VALID_URL, url)
50 video_id = mobj.group('id')
52 video = self._download_json('http://vube.com/api/v2/video/%s' % video_id,
53 video_id, 'Downloading video JSON')
55 public_id = video['public_id']
57 formats = [{'url': 'http://video.thestaticvube.com/video/%s/%s.mp4' % (fmt['media_resolution_id'], public_id),
58 'height': int(fmt['height']),
59 'abr': int(fmt['audio_bitrate']),
60 'vbr': int(fmt['video_bitrate']),
61 'format_id': fmt['media_resolution_id']
62 } for fmt in video['mtm'] if fmt['transcoding_status'] == 'processed']
64 self._sort_formats(formats)
66 title = video['title']
67 description = video.get('description')
68 thumbnail = video['thumbnail_src']
69 if thumbnail.startswith('//'):
70 thumbnail = 'http:' + thumbnail
71 uploader = video['user_alias']
72 uploader_id = video['user_url_id']
73 timestamp = int(video['upload_time'])
74 duration = video['duration']
75 view_count = video['raw_view_count']
76 like_count = video['total_likes']
77 dislike_count= video['total_hates']
79 comment = self._download_json('http://vube.com/api/video/%s/comment' % video_id,
80 video_id, 'Downloading video comment JSON')
82 comment_count = comment['total']
88 'description': description,
89 'thumbnail': thumbnail,
91 'uploader_id': uploader_id,
92 'timestamp': timestamp,
94 'view_count': view_count,
95 'like_count': like_count,
96 'dislike_count': dislike_count,
97 'comment_count': comment_count,