[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / xanimu.py
blobb4893587790cfc544bdce62209be02b99a59bd25
1 import re
3 from .common import InfoExtractor
4 from ..utils import int_or_none
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,
19 'age_limit': 18,
21 }, {
22 'url': 'https://xanimu.com/huge-expansion/',
23 'only_matching': True,
26 def _real_extract(self, url):
27 video_id = self._match_id(url)
28 webpage = self._download_webpage(url, video_id)
30 formats = []
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'[\'"]([^\'"]+)[\'"]')
35 if format_url:
36 formats.append({
37 'url': format_url,
38 'format_id': format_id,
39 'quality': -2 if format_id.endswith('Low') else None,
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)),
51 'age_limit': 18,