aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/xanimu.py
diff options
context:
space:
mode:
authorJChris246 <43832407+JChris246@users.noreply.github.com>2023-01-06 16:09:37 -0400
committerGitHub <noreply@github.com>2023-01-07 01:39:37 +0530
commitb382c1fc6a6bfff1b6373296961beabe60ffb72c (patch)
treeb06646707639bbed660ceeec3bb80738e87d1132 /yt_dlp/extractor/xanimu.py
parent8a6b1677234c2b4e0d9279cb2eb7475c36523c72 (diff)
downloadhypervideo-pre-b382c1fc6a6bfff1b6373296961beabe60ffb72c.tar.lz
hypervideo-pre-b382c1fc6a6bfff1b6373296961beabe60ffb72c.tar.xz
hypervideo-pre-b382c1fc6a6bfff1b6373296961beabe60ffb72c.zip
[xanimu] Add extractor (#5969)
Authored by: JChris246 Closes #5810
Diffstat (limited to 'yt_dlp/extractor/xanimu.py')
-rw-r--r--yt_dlp/extractor/xanimu.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/yt_dlp/extractor/xanimu.py b/yt_dlp/extractor/xanimu.py
new file mode 100644
index 000000000..2a1ec2775
--- /dev/null
+++ b/yt_dlp/extractor/xanimu.py
@@ -0,0 +1,51 @@
+import re
+
+from ..utils import int_or_none
+from .common import InfoExtractor
+
+
+class XanimuIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?xanimu\.com/(?P<id>[^/]+)/?'
+ _TESTS = [{
+ 'url': 'https://xanimu.com/51944-the-princess-the-frog-hentai/',
+ 'md5': '899b88091d753d92dad4cb63bbf357a7',
+ 'info_dict': {
+ 'id': '51944-the-princess-the-frog-hentai',
+ 'ext': 'mp4',
+ 'title': 'The Princess + The Frog Hentai',
+ 'thumbnail': 'https://xanimu.com/storage/2020/09/the-princess-and-the-frog-hentai.jpg',
+ 'description': r're:^Enjoy The Princess \+ The Frog Hentai',
+ 'duration': 207.0,
+ 'age_limit': 18
+ }
+ }, {
+ 'url': 'https://xanimu.com/huge-expansion/',
+ 'only_matching': True
+ }]
+
+ def _real_extract(self, url):
+ video_id = self._match_id(url)
+ webpage = self._download_webpage(url, video_id)
+
+ formats = []
+ for format in ['videoHigh', 'videoLow']:
+ format_url = self._search_json(r'var\s+%s\s*=' % re.escape(format), webpage, format,
+ video_id, default=None, contains_pattern=r'[\'"]([^\'"]+)[\'"]')
+ if format_url:
+ formats.append({
+ 'url': format_url,
+ 'format_id': format,
+ 'quality': -2 if format.endswith('Low') else None,
+ })
+
+ return {
+ 'id': video_id,
+ 'formats': formats,
+ 'title': self._search_regex(r'[\'"]headline[\'"]:\s*[\'"]([^"]+)[\'"]', webpage,
+ 'title', default=None) or self._html_extract_title(webpage),
+ 'thumbnail': self._html_search_meta('thumbnailUrl', webpage, default=None),
+ 'description': self._html_search_meta('description', webpage, default=None),
+ 'duration': int_or_none(self._search_regex(r'duration:\s*[\'"]([^\'"]+?)[\'"]',
+ webpage, 'duration', fatal=False)),
+ 'age_limit': 18
+ }