2 from .common
import InfoExtractor
13 class Porn91IE(InfoExtractor
):
15 _VALID_URL
= r
'(?:https?://)(?:www\.|)91porn\.com/view_video.php\?([^#]+&)?viewkey=(?P<id>\w+)'
18 'url': 'http://91porn.com/view_video.php?viewkey=7e42283b4f5ab36da134',
19 'md5': 'd869db281402e0ef4ddef3c38b866f86',
21 'id': '7e42283b4f5ab36da134',
22 'title': '18岁大一漂亮学妹,水嫩性感,再爽一次!',
23 'description': 'md5:1ff241f579b07ae936a54e810ad2e891',
26 'upload_date': '20150520',
32 'url': 'https://91porn.com/view_video.php?viewkey=7ef0cf3d362c699ab91c',
33 'md5': 'f8fd50540468a6d795378cd778b40226',
35 'id': '7ef0cf3d362c699ab91c',
36 'title': '真实空乘,冲上云霄第二部',
37 'description': 'md5:618bf9652cafcc66cd277bd96789baea',
40 'upload_date': '20221119',
47 def _real_extract(self
, url
):
48 video_id
= self
._match
_id
(url
)
49 self
._set
_cookie
('91porn.com', 'language', 'cn_CN')
51 webpage
= self
._download
_webpage
(
52 'http://91porn.com/view_video.php?viewkey=%s' % video_id
, video_id
)
54 if '视频不存在,可能已经被删除或者被举报为不良内容!' in webpage
:
55 raise ExtractorError('91 Porn says: Video does not exist', expected
=True)
57 daily_limit
= self
._search
_regex
(
58 r
'作为游客,你每天只可观看([\d]+)个视频', webpage
, 'exceeded daily limit', default
=None, fatal
=False)
60 raise ExtractorError(f
'91 Porn says: Daily limit {daily_limit} videos exceeded', expected
=True)
62 video_link_url
= self
._search
_regex
(
63 r
'document\.write\(\s*strencode2\s*\(\s*((?:"[^"]+")|(?:\'[^
\']+\'))', webpage, 'video link
')
64 video_link_url = self._search_regex(
65 r'src
=["\']([^"\']+)["\']', urllib.parse.unquote(video_link_url), 'unquoted video link')
67 formats, subtitles = self._get_formats_and_subtitle(video_link_url, video_id)
71 'title': remove_end(self._html_extract_title(webpage).replace('\n', ''), 'Chinese homemade video').strip(),
73 'subtitles': subtitles,
74 'upload_date': unified_strdate(self._search_regex(
75 r'<span\s+class=["\']title
-yakov
["\']>(\d{4}-\d{2}-\d{2})</span>', webpage, 'upload_date', fatal=False)),
76 'description': self._html_search_regex(
77 r'<span\s+class=["\']more title
["\']>\s*([^<]+)', webpage, 'description', fatal=False),
78 'duration': parse_duration(self._search_regex(
79 r'时长:\s*<span[^>]*>\s*(\d+(?::\d+){1,2})', webpage, 'duration', fatal=False)),
80 'comment_count': int_or_none(self._search_regex(
81 r'留言:\s*<span[^>]*>\s*(\d+)\s*</span>', webpage, 'comment count', fatal=False)),
82 'view_count': int_or_none(self._search_regex(
83 r'热度:\s*<span[^>]*>\s*(\d+)\s*</span>', webpage, 'view count', fatal=False)),
87 def _get_formats_and_subtitle(self, video_link_url, video_id):
88 ext = determine_ext(video_link_url)
90 formats, subtitles = self._extract_m3u8_formats_and_subtitles(video_link_url, video_id, ext='mp4')
92 formats = [{'url': video_link_url, 'ext': ext}]
95 return formats, subtitles