]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/manyvids.py
[facebook] fix tahoe request(closes #17171)
[yt-dlp.git] / youtube_dl / extractor / manyvids.py
CommitLineData
e9b86526
J
1# coding: utf-8
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
efc57145 5from ..utils import int_or_none
e9b86526
J
6
7
8class ManyVidsIE(InfoExtractor):
efc57145 9 _VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
e9b86526
J
10 _TEST = {
11 'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/',
12 'md5': '03f11bb21c52dd12a05be21a5c7dcc97',
13 'info_dict': {
14 'id': '133957',
15 'ext': 'mp4',
efc57145
S
16 'title': 'everthing about me (Preview)',
17 'view_count': int,
18 'like_count': int,
19 },
e9b86526
J
20 }
21
22 def _real_extract(self, url):
e9b86526 23 video_id = self._match_id(url)
efc57145 24
e9b86526 25 webpage = self._download_webpage(url, video_id)
e9b86526 26
efc57145
S
27 video_url = self._search_regex(
28 r'data-(?:video-filepath|meta-video)\s*=s*(["\'])(?P<url>(?:(?!\1).)+)\1',
29 webpage, 'video URL', group='url')
30
31 title = '%s (Preview)' % self._html_search_regex(
32 r'<h2[^>]+class="m-a-0"[^>]*>([^<]+)', webpage, 'title')
33
34 like_count = int_or_none(self._search_regex(
35 r'data-likes=["\'](\d+)', webpage, 'like count', default=None))
36 view_count = int_or_none(self._html_search_regex(
37 r'(?s)<span[^>]+class="views-wrapper"[^>]*>(.+?)</span', webpage,
38 'view count', default=None))
39
e9b86526
J
40 return {
41 'id': video_id,
42 'title': title,
efc57145
S
43 'view_count': view_count,
44 'like_count': like_count,
45 'formats': [{
46 'url': video_url,
47 }],
e9b86526 48 }