提交 0ae5ff3e 编写于 作者: H hjdhnx

完成cms搜索数据封装

上级 4bbc7391
......@@ -53,8 +53,6 @@ def vod():
ctx,js_code = parser.runJs(js_path)
rule = ctx.eval('rule')
cms = CMS(rule)
print(cms)
print(cms.title)
wd = getParmas('wd')
ac = getParmas('ac')
quick = getParmas('quick')
......@@ -66,9 +64,23 @@ def vod():
ext = getParmas('ext')
ids = getParmas('ids')
q = getParmas('q')
print(getParmas())
return jsonify({'rule':rule,'js_code':js_code})
if ac and t: # 一级
data = cms.categoryContent(t,pg)
# print(data)
return jsonify(data)
if ac and ids: # 二级
data = cms.detailContent(ids.split(','))
# print(data)
return jsonify(data)
if wd: # 搜索
data = cms.searchContent(wd)
# print(data)
return jsonify(data)
# return jsonify({'rule':rule,'js_code':js_code})
home_data = cms.homeContent()
return jsonify(home_data)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=9000)
\ No newline at end of file
var rule = {
title:'鸭奈飞',
url:'https://yanetflix.com/vodshow/fyclass--------fypage---.html',
detailUrl:'https://yanetflix.com/voddetail/fyid.html',
detailUrl:'https://yanetflix.com/voddetail/fyid.html',//非必填
// url:'https://yanetflix.com/vodshow/',
searchUrl:'/vodsearch/**----------fypage---.html',
ua:'MOBILE_UA',
......
......@@ -121,8 +121,11 @@ class CMS:
:return:
"""
# video-info-header
fyid = array[0]
url = self.detailUrl.replace('fyid', fyid)
fyid = str(array[0])
if not fyid.startswith('http'):
url = self.detailUrl.replace('fyid', fyid)
else:
url = fyid
print(url)
headers = {'user-agent': self.ua}
r = requests.get(url, headers=headers)
......@@ -203,7 +206,7 @@ class CMS:
}
return result
def searchContent(self, key, fypage=1,quick=1):
def searchContent(self, key, fypage=1):
pg = str(fypage)
url = self.searchUrl.replace('**', key).replace('fypage',pg)
if not str(url).startswith('http'):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册