1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-12-22 09:32:56 +08:00

[manyvids] Improve (closes #14059)

This commit is contained in:
Sergey M․ 2017-09-03 17:30:02 +07:00
parent e9b865267a
commit efc57145c1
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -2,35 +2,47 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote from ..utils import int_or_none
class ManyVidsIE(InfoExtractor): class ManyVidsIE(InfoExtractor):
_VALID_URL = r'https?://www.manyvids\.com/Video/(?P<id>[0-9]+)' _VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TEST = { _TEST = {
'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/', 'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/',
'md5': '03f11bb21c52dd12a05be21a5c7dcc97', 'md5': '03f11bb21c52dd12a05be21a5c7dcc97',
'info_dict': { 'info_dict': {
'id': '133957', 'id': '133957',
'ext': 'mp4', 'ext': 'mp4',
'title': 'everthing about me', 'title': 'everthing about me (Preview)',
'view_count': int,
} 'like_count': int,
},
} }
def _real_extract(self, url): def _real_extract(self, url):
formats = []
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
video_url = compat_urllib_parse_unquote(self._search_regex(
r'data-video-filepath=\"(.+?)\"', webpage, 'video URL', default=''))
title = self._html_search_regex(r'<h2[^>]+class="m-a-0"[^>]*>([^<]+)', webpage, 'title') webpage = self._download_webpage(url, video_id)
formats.append({
'url': video_url video_url = self._search_regex(
}) r'data-(?:video-filepath|meta-video)\s*=s*(["\'])(?P<url>(?:(?!\1).)+)\1',
webpage, 'video URL', group='url')
title = '%s (Preview)' % self._html_search_regex(
r'<h2[^>]+class="m-a-0"[^>]*>([^<]+)', webpage, 'title')
like_count = int_or_none(self._search_regex(
r'data-likes=["\'](\d+)', webpage, 'like count', default=None))
view_count = int_or_none(self._html_search_regex(
r'(?s)<span[^>]+class="views-wrapper"[^>]*>(.+?)</span', webpage,
'view count', default=None))
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
'formats': formats, 'view_count': view_count,
'like_count': like_count,
'formats': [{
'url': video_url,
}],
} }