提交 f0ef3ac1 编写于 作者: H hjdhnx

增加了菜狗热搜

上级 e15a6ff5
无法预览此类型文件
......@@ -18,7 +18,7 @@ from utils.cfg import cfg
from utils import parser
from utils.log import logger
from utils.files import getAlist,get_live_url
from utils.update import getLocalVer
from utils.update import getLocalVer,getHotSuggest
from utils.encode import parseText
from js.rules import getJxs
import random
......@@ -179,6 +179,11 @@ def getCustonDict(host):
logger.info(f'用户自定义配置加载失败:{e}')
return customConfig
@home.route('/hotsugg')
def get_hot_search():
data = getHotSuggest()
return R.success('获取成功',data)
@home.route('/config/<int:mode>')
def config_render(mode):
# print(dict(app.config))
......
3.5.9
\ No newline at end of file
3.6.0
\ No newline at end of file
......@@ -50,6 +50,7 @@
- [X] 1.升级至3.5.8
- [X] 2.迁移alist.conf文件,修改默认模板,增加模板url参数支持fyfilter变量从此支持更多筛选场景
- [X] 3.升级至3.5.9,修复重大bug:模板继承导致的自动生成配置的搜索开关异常问题
- [X] 4.增加菜狗热搜
###### 2022/09/12
###### 特别说明:仅pluto 1.4.2以上版本支持此项目的筛选及自定义播放免嗅
- [X] 1.升级至3.5.7
......
......@@ -66,6 +66,30 @@
}{% if loop.last==False %},{% endif %}{% endfor %}
],
"flags": ["imgo","youku", "qq", "iqiyi", "qiyi", "letv", "sohu", "tudou","xigua","cntv","1905", "pptv", "mgtv", "wasu", "bilibili", "renrenmi"],
"hotSearch": [{
"name": "mobilesearch",
"request": {
"method": "GET",
"header": [
{
"key": "Referer",
"value": "{{ host }}"
}
],
"url": {
"raw": "{{ host }}/hotsugg?t={time}"
}
},
"response": {
"result": "$.data",
"data": [
{
"key": "keyword",
"value": "title"
}
]
}
}],
"lives":[{"group":"redirect","channels":[{"name":"直播","urls":["proxy://do=live&type=txt&ext={{live_url}}"]}]}],
"ijk": [{
"group": "软解码",
......
......@@ -75,7 +75,7 @@ def custom_merge(original:dict,custom:dict):
new_keys = custom.keys()
updateObj = {}
extend_obj = {}
for key in ['wallpaper','spider','homepage','lives']:
for key in ['wallpaper','spider','homepage','lives','hotSearch']:
if key in new_keys:
updateObj[key] = custom[key]
......
......@@ -12,12 +12,29 @@ import zipfile
import shutil # https://blog.csdn.net/weixin_33130113/article/details/112336581
from utils.log import logger
from utils.web import get_interval
from utils.htmlParser import jsoup
headers = {
'Referer': 'https://gitcode.net/',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36',
}
def getHotSuggest(url='http://4g.v.sogou.com/hotsugg'):
jsp = jsoup(url)
pdfh = jsp.pdfh
pdfa = jsp.pdfa
pd = jsp.pd
try:
r = requests.get(url,headers=headers,timeout=2)
html = r.text
data = pdfa(html,'ul.hot-list&&li')
suggs = [{'title':pdfh(dt,'a&&Text'),'url':pd(dt,'a&&href')} for dt in data]
# print(html)
# print(suggs)
return suggs
except:
return []
def getLocalVer():
base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录
version_path = os.path.join(base_path, f'js/version.txt')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册