]>
Commit | Line | Data |
---|---|---|
b382c1fc J |
1 | import re |
2 | ||
b382c1fc | 3 | from .common import InfoExtractor |
edfc7725 | 4 | from ..utils import int_or_none |
b382c1fc J |
5 | |
6 | ||
7 | class XanimuIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?' | |
9 | _TESTS = [{ | |
10 | 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/', | |
11 | 'md5': '899b88091d753d92dad4cb63bbf357a7', | |
12 | 'info_dict': { | |
13 | 'id': '51944-the-princess-the-frog-hentai', | |
14 | 'ext': 'mp4', | |
15 | 'title': 'The Princess + The Frog Hentai', | |
16 | 'thumbnail': 'https://xanimu.com/storage/2020/09/the-princess-and-the-frog-hentai.jpg', | |
17 | 'description': r're:^Enjoy The Princess \+ The Frog Hentai', | |
18 | 'duration': 207.0, | |
add96eb9 | 19 | 'age_limit': 18, |
20 | }, | |
b382c1fc J |
21 | }, { |
22 | 'url': 'https://xanimu.com/huge-expansion/', | |
add96eb9 | 23 | 'only_matching': True, |
b382c1fc J |
24 | }] |
25 | ||
26 | def _real_extract(self, url): | |
27 | video_id = self._match_id(url) | |
28 | webpage = self._download_webpage(url, video_id) | |
29 | ||
30 | formats = [] | |
add96eb9 | 31 | for format_id in ['videoHigh', 'videoLow']: |
32 | format_url = self._search_json( | |
33 | rf'var\s+{re.escape(format_id)}\s*=', webpage, format_id, | |
34 | video_id, default=None, contains_pattern=r'[\'"]([^\'"]+)[\'"]') | |
b382c1fc J |
35 | if format_url: |
36 | formats.append({ | |
37 | 'url': format_url, | |
add96eb9 | 38 | 'format_id': format_id, |
39 | 'quality': -2 if format_id.endswith('Low') else None, | |
b382c1fc J |
40 | }) |
41 | ||
42 | return { | |
43 | 'id': video_id, | |
44 | 'formats': formats, | |
45 | 'title': self._search_regex(r'[\'"]headline[\'"]:\s*[\'"]([^"]+)[\'"]', webpage, | |
46 | 'title', default=None) or self._html_extract_title(webpage), | |
47 | 'thumbnail': self._html_search_meta('thumbnailUrl', webpage, default=None), | |
48 | 'description': self._html_search_meta('description', webpage, default=None), | |
49 | 'duration': int_or_none(self._search_regex(r'duration:\s*[\'"]([^\'"]+?)[\'"]', | |
50 | webpage, 'duration', fatal=False)), | |
add96eb9 | 51 | 'age_limit': 18, |
b382c1fc | 52 | } |