2 from __future__ import unicode_literals
4 from ..compat import compat_urllib_parse
5 from .common import InfoExtractor
12 class Porn91IE(InfoExtractor):
14 _VALID_URL = r'(?:https?://)(?:www\.|)91porn\.com/.+?\?viewkey=(?P<id>[\w\d]+)'
17 'url': 'http://91porn.com/view_video.php?viewkey=7e42283b4f5ab36da134',
18 'md5': '6df8f6d028bc8b14f5dbd73af742fb20',
20 'id': '7e42283b4f5ab36da134',
21 'title': '18岁大一漂亮学妹,水嫩性感,再爽一次!',
27 def _real_extract(self, url):
28 video_id = self._match_id(url)
29 url = 'http://91porn.com/view_video.php?viewkey=%s' % video_id
30 self._set_cookie('91porn.com', 'language', 'cn_CN')
31 webpage = self._download_webpage(url, video_id, "get HTML content")
32 title = self._search_regex(
33 r'<div id="viewvideo-title">([^<]+)</div>', webpage, 'title')
34 title = title.replace('\n', '')
37 file_id = self._search_regex(
38 r'so.addVariable\(\'file\',\'(\d+)\'', webpage, 'file id')
39 sec_code = self._search_regex(
40 r'so.addVariable\(\'seccode\',\'([^\']+)\'', webpage, 'sec code')
41 max_vid = self._search_regex(
42 r'so.addVariable\(\'max_vid\',\'(\d+)\'', webpage, 'max vid')
43 url_params = compat_urllib_parse.urlencode({
49 info_cn = self._download_webpage(
50 'http://91porn.com/getfile.php?' + url_params, video_id,
52 video_url = self._search_regex(r'file=([^&]+)&', info_cn, 'url')
54 duration = parse_duration(self._search_regex(
55 r'时长:\s*</span>\s*(\d+:\d+)', webpage, 'duration', fatal=False))
57 comment_count = int_or_none(self._search_regex(
58 r'留言:\s*</span>\s*(\d+)', webpage, 'comment count', fatal=False))
65 'comment_count': comment_count,