1 from __future__ import unicode_literals
3 from .common import InfoExtractor, ExtractorError
11 class VidmeIE(InfoExtractor):
12 _VALID_URL = r'https?://vid\.me/(?:e/)?(?P<id>[\da-zA-Z]+)'
14 'url': 'https://vid.me/QNB',
15 'md5': 'c62f1156138dc3323902188c5b5a8bd6',
19 'title': 'Fishing for piranha - the easy way',
20 'description': 'source: https://www.facebook.com/photo.php?v=312276045600871',
22 'timestamp': 1406313244,
23 'upload_date': '20140725',
24 'thumbnail': 're:^https?://.*\.jpg',
30 'url': 'https://vid.me/Gc6M',
31 'md5': 'f42d05e7149aeaec5c037b17e5d3dc82',
35 'title': 'O Mere Dil ke chain - Arnav and Khushi VM',
37 'timestamp': 1441211642,
38 'upload_date': '20150902',
39 'thumbnail': 're:^https?://.*\.jpg',
46 'skip_download': True,
49 # tests uploader field
50 'url': 'https://vid.me/4Iib',
54 'title': 'The Carver',
55 'description': 'md5:e9c24870018ae8113be936645b93ba3c',
56 'duration': 97.859999999999999,
57 'timestamp': 1433203629,
58 'upload_date': '20150602',
60 'thumbnail': 're:^https?://.*\.jpg',
66 'skip_download': True,
69 # From http://naked-yogi.tumblr.com/post/118312946248/naked-smoking-stretching
70 'url': 'https://vid.me/e/Wmur',
71 'only_matching': True,
74 def _real_extract(self, url):
75 video_id = self._match_id(url)
76 api_url = 'https://api.vid.me/videoByUrl/' + video_id
77 data = self._download_json(api_url, video_id)
79 video_data = data.get('video')
80 if video_data is None:
81 raise ExtractorError('Could not extract the vid.me video data')
83 title = video_data.get('title')
84 description = video_data.get('description')
85 thumbnail = video_data.get('thumbnail_url')
86 timestamp = parse_iso8601(video_data.get('date_created'), ' ')
87 duration = float_or_none(video_data.get('duration'))
88 view_count = int_or_none(video_data.get('view_count'))
89 like_count = int_or_none(video_data.get('likes_count'))
90 comment_count = int_or_none(video_data.get('comment_count'))
93 user_data = video_data.get('user')
94 if user_data is not None:
95 uploader = user_data.get('username')
98 'format_id': format['type'],
100 'width': int_or_none(format['width']),
101 'height': int_or_none(format['height']),
102 } for format in video_data.get('formats', [])]
103 self._sort_formats(formats)
108 'description': description,
109 'thumbnail': thumbnail,
110 'timestamp': timestamp,
111 'duration': duration,
112 'view_count': view_count,
113 'like_count': like_count,
114 'comment_count': comment_count,
115 'uploader': uploader,