完善辅助嗅探和本地代理

This commit is contained in:
晚风拂柳颜 2024-01-13 22:06:57 +08:00
parent 0d692cd089
commit 80d8ec0566
3 changed files with 20 additions and 11 deletions

View File

@ -1 +1 @@
3.9.49beta23
3.9.49beta24

View File

@ -168,6 +168,14 @@ class Spider(BaseSpider): # 元类 默认的元类 type
self.module = lib
break
def isVideo(self):
"""
返回是否为视频的匹配字符串
@return: None空 reg:正则表达式 js:input js代码
"""
# return 'js:input.includes("https://zf.13to.com/")?true:false'
return 'reg:zf\.13to\.com'
def isVideoFormat(self, url):
pass
@ -385,6 +393,16 @@ class Spider(BaseSpider): # 元类 默认的元类 type
@param vipFlags: vip标识
@return:
"""
headers = {
'User-Agent': 'Mozilla/5.0 (Linux Android 11 M2007J3SC Build/RKQ1.200826.002 wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/99.0.4844.48 Mobile Safari/537.36',
'Referer': id,
}
return {
'parse': 1, # 1=嗅探,0=播放
'playUrl': '', # 解析链接
'url': id, # 直链或待嗅探地址
'header': headers, # 播放UA
}
r = self.fetch(id)
html = r.text
text = html.split('window.wp_nonce=')[1].split('eval')[0]

View File

@ -414,16 +414,7 @@ class Spider(BaseSpider): # 元类 默认的元类 type
content = pdata.strip()
media_type = 'text/plain' if 'txt' in name else 'video/MP2T'
action = {
'url': url,
'header': headers,
'param': '',
'type': media_type,
}
if '3' in self.ENV:
return [200, media_type, action, content]
else:
return [200, media_type, content]
return [200, media_type, content]
# -----------------------------------------------自定义函数-----------------------------------------------
def decode(self, text):