From 7e0d7ca2ea82e60a63ee72edccbc95e157df5681 Mon Sep 17 00:00:00 2001 From: qiaoruntao Date: Sun, 17 Aug 2025 21:51:10 +0800 Subject: [PATCH] git commit -m '[HSex] Add extractor' --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/hsex.py | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 yt_dlp/extractor/hsex.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index bb595f924b..776c1b9d1f 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -816,6 +816,7 @@ from .hse import ( HSEProductIE, HSEShowIE, ) +from .hsex import HSexIE from .huajiao import HuajiaoIE from .huffpost import HuffPostIE from .hungama import ( diff --git a/yt_dlp/extractor/hsex.py b/yt_dlp/extractor/hsex.py new file mode 100644 index 0000000000..d6f776ed09 --- /dev/null +++ b/yt_dlp/extractor/hsex.py @@ -0,0 +1,48 @@ +from .common import InfoExtractor + + +class HSexIE(InfoExtractor): + IE_NAME = 'hsex' + _VALID_URL = r'https?://hsex\.men/(?Pvideo-[0-9]+)\.htm' + _TESTS = [{ + 'url': 'https://hsex.men/video-1016887.htm', + 'info_dict': { + 'id': 'video-1016887', + 'title': '这才是真正的暴力打桩狂操!高潮迭起彻底释放【简界免费看完整版】.', + 'description': '这才是真正的暴力打桩狂操!高潮迭起彻底释放【简界免费看完整版】.', + 'uploader_id': 'jdjjfrnn', + 'duration_string': '00:12:14', + 'ext': 'mp4', + 'age_limit': 18, + }, + }, { + 'url': 'https://hsex.men/video-594002.htm', + 'info_dict': { + 'id': 'video-594002', + 'title': '《探总奉上》热爱黑丝丝袜,撕开了干', + 'description': '《探总奉上》热爱黑丝丝袜,撕开了干', + 'uploader_id': '91探花探总', + 'duration_string': '00:25:07', + 'ext': 'mp4', + 'age_limit': 18, + }, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id, impersonate=True) + title = self._html_search_meta(['og:title', 'name'], webpage) + description = self._html_search_meta(['og:description', 'description'], webpage) + uploader_id = self._html_search_meta(['og:video:actor'], webpage) + duration_string = self._html_search_meta(['video:duration', 'duration'], webpage) + video_url = self._search_regex(r'"video-source" src="(.+?)"', webpage, 'video_url', fatal=True) + formats, _ = self._extract_m3u8_formats_and_subtitles(video_url, video_id, ext='mp4') + return { + 'id': video_id, + 'title': title, + 'description': description, + 'uploader_id': uploader_id, + 'duration_string': duration_string, + 'formats': formats, + 'age_limit': 18, + }