2 from __future__ import unicode_literals
4 from .common import InfoExtractor
13 class ManyVidsIE(InfoExtractor):
14 _VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
17 'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/',
18 'md5': '03f11bb21c52dd12a05be21a5c7dcc97',
22 'title': 'everthing about me (Preview)',
28 'url': 'https://www.manyvids.com/Video/935718/MY-FACE-REVEAL/',
29 'md5': 'f3e8f7086409e9b470e2643edb96bdcc',
33 'title': 'MY FACE REVEAL',
39 def _real_extract(self, url):
40 video_id = self._match_id(url)
42 webpage = self._download_webpage(url, video_id)
44 video_url = self._search_regex(
45 r'data-(?:video-filepath|meta-video)\s*=s*(["\'])(?P<url>(?:(?!\1).)+)\1',
46 webpage, 'video URL', group='url')
48 title = self._html_search_regex(
49 (r'<span[^>]+class=["\']item-title[^>]+>([^<]+)',
50 r'<h2[^>]+class=["\']h2 m-0["\'][^>]*>([^<]+)'),
51 webpage, 'title', default=None) or self._html_search_meta(
52 'twitter:title', webpage, 'title', fatal=True)
54 if any(p in webpage for p in ('preview_videos', '_preview.mp4')):
57 mv_token = self._search_regex(
58 r'data-mvtoken=(["\'])(?P<value>(?:(?!\1).)+)\1', webpage,
59 'mv token', default=None, group='value')
63 self._download_webpage(
64 'https://www.manyvids.com/includes/ajax_repository/you_had_me_at_hello.php',
65 video_id, fatal=False, data=urlencode_postdata({
70 'X-Requested-With': 'XMLHttpRequest'
73 if determine_ext(video_url) == 'm3u8':
74 formats = self._extract_m3u8_formats(
75 video_url, video_id, 'mp4', entry_protocol='m3u8_native',
78 formats = [{'url': video_url}]
80 like_count = int_or_none(self._search_regex(
81 r'data-likes=["\'](\d+)', webpage, 'like count', default=None))
82 view_count = str_to_int(self._html_search_regex(
83 r'(?s)<span[^>]+class="views-wrapper"[^>]*>(.+?)</span', webpage,
84 'view count', default=None))
89 'view_count': view_count,
90 'like_count': like_count,