mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 20:30:41 -05:00
[porn91] Simplify
This commit is contained in:
parent
9ff811c5cd
commit
1c22238756
1 changed files with 16 additions and 22 deletions
|
@ -1,8 +1,6 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from ..compat import compat_urllib_parse
|
from ..compat import compat_urllib_parse
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
@ -22,38 +20,34 @@ class Porn91IE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
video_id = self._match_id(url)
|
||||||
video_id = mobj.group('id')
|
|
||||||
url = 'http://91porn.com/view_video.php?viewkey=%s' % video_id
|
url = 'http://91porn.com/view_video.php?viewkey=%s' % video_id
|
||||||
self._set_cookie('91porn.com', 'language', 'cn_CN')
|
self._set_cookie('91porn.com', 'language', 'cn_CN')
|
||||||
webpage = self._download_webpage(url, video_id, "get HTML content")
|
webpage = self._download_webpage(url, video_id, "get HTML content")
|
||||||
title = self._search_regex(
|
title = self._search_regex(
|
||||||
r'<div id="viewvideo-title">(?P<title>.+?)</div>',
|
r'<div id="viewvideo-title">([^<]+)</div>', webpage, 'title')
|
||||||
webpage, 'title', flags=re.DOTALL)
|
|
||||||
title = title.replace('\n', '')
|
title = title.replace('\n', '')
|
||||||
|
|
||||||
# get real url
|
# get real url
|
||||||
n1 = self._search_regex(
|
file_id = self._search_regex(
|
||||||
r'so.addVariable\(\'file\',\'(?P<n1>\d+)\'', webpage, 'n1')
|
r'so.addVariable\(\'file\',\'(\d+)\'', webpage, 'file id')
|
||||||
n2 = self._search_regex(
|
sec_code = self._search_regex(
|
||||||
r'so.addVariable\(\'seccode\',\'(?P<n2>.+?)\'', webpage, 'n2')
|
r'so.addVariable\(\'seccode\',\'([^\']+)\'', webpage, 'sec code')
|
||||||
n3 = self._search_regex(
|
max_vid = self._search_regex(
|
||||||
r'so.addVariable\(\'max_vid\',\'(?P<n3>\d+)\'', webpage, 'n3')
|
r'so.addVariable\(\'max_vid\',\'(\d+)\'', webpage, 'max vid')
|
||||||
url_params = compat_urllib_parse.urlencode({
|
url_params = compat_urllib_parse.urlencode({
|
||||||
'VID': n1,
|
'VID': file_id,
|
||||||
'mp4': '1',
|
'mp4': '1',
|
||||||
'seccode': n2,
|
'seccode': sec_code,
|
||||||
'max_vid': n3,
|
'max_vid': max_vid,
|
||||||
})
|
})
|
||||||
t_url = 'http://91porn.com/getfile.php?' + url_params
|
info_cn = self._download_webpage(
|
||||||
info_cn = self._download_webpage(t_url, video_id, "get real video_url")
|
'http://91porn.com/getfile.php?' + url_params, video_id,
|
||||||
video_url = self._search_regex(r'file=(?P<url>http.+?)&', info_cn, 'url')
|
"get real video url")
|
||||||
|
video_url = self._search_regex(r'file=([^&]+)&', info_cn, 'url')
|
||||||
|
|
||||||
# construct info
|
return {
|
||||||
info = {
|
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
return info
|
|
||||||
|
|
Loading…
Reference in a new issue