|
|
@ -1,10 +1,10 @@
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from .common import InfoExtractor, ExtractorError
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
int_or_none,
|
|
|
|
float_or_none,
|
|
|
|
float_or_none,
|
|
|
|
str_to_int,
|
|
|
|
parse_iso8601,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -12,7 +12,7 @@ class VidmeIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://vid\.me/(?:e/)?(?P<id>[\da-zA-Z]+)'
|
|
|
|
_VALID_URL = r'https?://vid\.me/(?:e/)?(?P<id>[\da-zA-Z]+)'
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://vid.me/QNB',
|
|
|
|
'url': 'https://vid.me/QNB',
|
|
|
|
'md5': 'f42d05e7149aeaec5c037b17e5d3dc82',
|
|
|
|
'md5': 'c62f1156138dc3323902188c5b5a8bd6',
|
|
|
|
'info_dict': {
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'QNB',
|
|
|
|
'id': 'QNB',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'ext': 'mp4',
|
|
|
@ -24,6 +24,26 @@ class VidmeIE(InfoExtractor):
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg',
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg',
|
|
|
|
'view_count': int,
|
|
|
|
'view_count': int,
|
|
|
|
'like_count': int,
|
|
|
|
'like_count': int,
|
|
|
|
|
|
|
|
'comment_count': int,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
'url': 'https://vid.me/Gc6M',
|
|
|
|
|
|
|
|
'md5': 'f42d05e7149aeaec5c037b17e5d3dc82',
|
|
|
|
|
|
|
|
'info_dict': {
|
|
|
|
|
|
|
|
'id': 'Gc6M',
|
|
|
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
|
|
|
'title': 'O Mere Dil ke chain - Arnav and Khushi VM',
|
|
|
|
|
|
|
|
'duration': 223.72,
|
|
|
|
|
|
|
|
'timestamp': 1441211642,
|
|
|
|
|
|
|
|
'upload_date': '20150902',
|
|
|
|
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg',
|
|
|
|
|
|
|
|
'view_count': int,
|
|
|
|
|
|
|
|
'like_count': int,
|
|
|
|
|
|
|
|
'comment_count': int,
|
|
|
|
|
|
|
|
'comment_count': int,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
'params': {
|
|
|
|
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
# tests uploader field
|
|
|
|
# tests uploader field
|
|
|
@ -40,6 +60,7 @@ class VidmeIE(InfoExtractor):
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg',
|
|
|
|
'thumbnail': 're:^https?://.*\.jpg',
|
|
|
|
'view_count': int,
|
|
|
|
'view_count': int,
|
|
|
|
'like_count': int,
|
|
|
|
'like_count': int,
|
|
|
|
|
|
|
|
'comment_count': int,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
|
|
|
'skip_download': True,
|
|
|
@ -51,45 +72,46 @@ class VidmeIE(InfoExtractor):
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
url = url.replace('vid.me/e/', 'vid.me/')
|
|
|
|
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
api_url = 'https://api.vid.me/videoByUrl/' + video_id
|
|
|
|
|
|
|
|
data = self._download_json(api_url, video_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
video_data = data.get('video')
|
|
|
|
|
|
|
|
if video_data is None:
|
|
|
|
|
|
|
|
raise ExtractorError('Could not extract the vid.me video data')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
title = video_data.get('title')
|
|
|
|
|
|
|
|
description = video_data.get('description')
|
|
|
|
|
|
|
|
thumbnail = video_data.get('thumbnail_url')
|
|
|
|
|
|
|
|
timestamp = parse_iso8601(video_data.get('date_created'), ' ')
|
|
|
|
|
|
|
|
duration = float_or_none(video_data.get('duration'))
|
|
|
|
|
|
|
|
view_count = int_or_none(video_data.get('view_count'))
|
|
|
|
|
|
|
|
like_count = int_or_none(video_data.get('likes_count'))
|
|
|
|
|
|
|
|
comment_count = int_or_none(video_data.get('comment_count'))
|
|
|
|
|
|
|
|
|
|
|
|
video_url = self._html_search_regex(
|
|
|
|
uploader = None
|
|
|
|
r'<source src="([^"]+)"', webpage, 'video URL')
|
|
|
|
user_data = video_data.get('user')
|
|
|
|
|
|
|
|
if user_data is not None:
|
|
|
|
|
|
|
|
uploader = user_data.get('username')
|
|
|
|
|
|
|
|
|
|
|
|
title = self._og_search_title(webpage)
|
|
|
|
formats = [{
|
|
|
|
description = self._og_search_description(webpage, default='')
|
|
|
|
'format_id': format['type'],
|
|
|
|
thumbnail = self._og_search_thumbnail(webpage)
|
|
|
|
'url': format['uri'],
|
|
|
|
timestamp = int_or_none(self._og_search_property(
|
|
|
|
'width': int_or_none(format['width']),
|
|
|
|
'updated_time', webpage, fatal=False))
|
|
|
|
'height': int_or_none(format['height']),
|
|
|
|
width = int_or_none(self._og_search_property(
|
|
|
|
} for format in video_data.get('formats', [])]
|
|
|
|
'video:width', webpage, fatal=False))
|
|
|
|
self._sort_formats(formats)
|
|
|
|
height = int_or_none(self._og_search_property(
|
|
|
|
|
|
|
|
'video:height', webpage, fatal=False))
|
|
|
|
|
|
|
|
duration = float_or_none(self._html_search_regex(
|
|
|
|
|
|
|
|
r'data-duration="([^"]+)"', webpage, 'duration', fatal=False))
|
|
|
|
|
|
|
|
view_count = str_to_int(self._html_search_regex(
|
|
|
|
|
|
|
|
r'<(?:li|span) class="video_views">\s*([\d,\.]+)\s*plays?',
|
|
|
|
|
|
|
|
webpage, 'view count', fatal=False))
|
|
|
|
|
|
|
|
like_count = str_to_int(self._html_search_regex(
|
|
|
|
|
|
|
|
r'class="score js-video-vote-score"[^>]+data-score="([\d,\.\s]+)">',
|
|
|
|
|
|
|
|
webpage, 'like count', fatal=False))
|
|
|
|
|
|
|
|
uploader = self._html_search_regex(
|
|
|
|
|
|
|
|
'class="video_author_username"[^>]*>([^<]+)',
|
|
|
|
|
|
|
|
webpage, 'uploader', default=None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'id': video_id,
|
|
|
|
'url': video_url,
|
|
|
|
|
|
|
|
'title': title,
|
|
|
|
'title': title,
|
|
|
|
'description': description,
|
|
|
|
'description': description,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'timestamp': timestamp,
|
|
|
|
'timestamp': timestamp,
|
|
|
|
'width': width,
|
|
|
|
|
|
|
|
'height': height,
|
|
|
|
|
|
|
|
'duration': duration,
|
|
|
|
'duration': duration,
|
|
|
|
'view_count': view_count,
|
|
|
|
'view_count': view_count,
|
|
|
|
'like_count': like_count,
|
|
|
|
'like_count': like_count,
|
|
|
|
|
|
|
|
'comment_count': comment_count,
|
|
|
|
'uploader': uploader,
|
|
|
|
'uploader': uploader,
|
|
|
|
|
|
|
|
'formats': formats,
|
|
|
|
}
|
|
|
|
}
|
|
|
|