diff --git a/base/rules.db b/base/rules.db index 733389c6e0df33bc8e2c18cfd6f8b1fada199dbb..8551cc2f0943473cf0cf0b4cc6fc9bbe057225af 100644 Binary files a/base/rules.db and b/base/rules.db differ diff --git a/controllers/home.py b/controllers/home.py index 18635ef2681f788ebfe6049592b0288723abd019..e8318bb63dbc0593e932012fbfa6d29353a60d6b 100644 --- a/controllers/home.py +++ b/controllers/home.py @@ -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/') def config_render(mode): # print(dict(app.config)) diff --git a/js/version.txt b/js/version.txt index 627de44f87811f9a644c3a64a931ceadf42ab95e..084e244cea3204c8100731723678a247cb12e5a4 100644 --- a/js/version.txt +++ b/js/version.txt @@ -1 +1 @@ -3.5.9 \ No newline at end of file +3.6.0 \ No newline at end of file diff --git a/readme.md b/readme.md index 2fb590e56b447efccd4c296c92977566a5af2f16..dc867b4d70fc6644360eba226b30710a617cf74a 100644 --- a/readme.md +++ b/readme.md @@ -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 diff --git a/templates/config.txt b/templates/config.txt index 01a1ac8d59de670f9b94d2ddb29465a97d512a45..eae688c10ef6a6d7b100af3eccc2abd6a08a9430 100644 --- a/templates/config.txt +++ b/templates/config.txt @@ -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": "软解码", diff --git a/utils/files.py b/utils/files.py index 2d4d1257c0bfb515b7e813860d09ceaa8e994d2d..c353514bc84ada3529ca298f603c39e52a969ba5 100644 --- a/utils/files.py +++ b/utils/files.py @@ -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] diff --git a/utils/update.py b/utils/update.py index 287addee1eebfb97abae3115b829f1d51aa81880..c5ea7c742c8ab9907abb31aa923d5c76d680648b 100644 --- a/utils/update.py +++ b/utils/update.py @@ -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')