10 Commits 2f61281dce ... c94e89405f

Author SHA1 Message Date
  hjdhnx c94e89405f 改了个版本,待处理问题 2 months ago
  hjdhnx 6b470a6ea7 修阿里土豆搜索 2 months ago
  hjdhnx 7fe1721d17 3 2 months ago
  hjdhnx 2e22fc0cef 2 2 months ago
  hjdhnx 9d8386bbde 1 2 months ago
  hjdhnx e98a141223 1 2 months ago
  hjdhnx c03d3998d6 1 2 months ago
  hjdhnx c080252917 取消pg单独写传参 2 months ago
  hjdhnx fc7f42c699 hipy升级,支持ext传参表,多个参数 2 months ago
  hjdhnx ab7e2c0cb4 升级采集之王 2 months ago

+ 29 - 1
app/apps/web/views.py

@@ -209,6 +209,8 @@ async def hipy_configs(*,
     # print(hipy_rules.get('results')[0])
     hipy_rules = [{
         'name': rec['name'],
+        # 增加ext_name属性用于模板渲染key和name
+        'ext_name': rec['name'],
         'file_type': rec['file_type'],
         'ext': rec['ext'] or '',
         'searchable': rec['searchable'],
@@ -217,8 +219,11 @@ async def hipy_configs(*,
         'order_num': rec['order_num'],
     } for rec in hipy_rules.get('results') or [] if rec['active'] and rec['is_exist']]
 
-    drpy_rules = [{
+    # 定义个基础版的
+    base_drpy_rules = [{
         'name': rec['name'],
+        # 增加ext_name属性用于模板渲染key和name
+        'ext_name': rec['name'],
         'file_type': rec['file_type'],
         'ext': rec['ext'] or '',
         'searchable': rec['searchable'],
@@ -227,6 +232,29 @@ async def hipy_configs(*,
         'order_num': rec['order_num'],
     } for rec in drpy_rules.get('results') or [] if rec['active'] and rec['is_exist']]
 
+    drpy_rules = []
+    for base_rule in base_drpy_rules:
+        # 多个传参
+        if base_rule['ext'] and len(base_rule['ext'].split('\n')) > 1:
+            i = 1
+            for rule_ext in base_rule['ext'].split('\n'):
+                ext_rule = base_rule.copy()
+                ext_param = rule_ext
+                ext_str = ext_param
+                ext_name = ext_rule['ext_name'] + str(i)
+                if '@' in ext_param:
+                    ext_str = ext_param.split('@')[0]
+                    ext_name = ext_param.split('@')[1] or ext_name
+
+                ext_rule['ext'] = ext_str
+                ext_rule['ext_name'] = ext_name
+
+                drpy_rules.append(ext_rule)
+
+                i += 1
+        else:
+            drpy_rules.append(base_rule)
+
     # print(hipy_rules)
     # print(drpy_rules)
     try:

+ 70 - 5
app/t4/files/drpy_js/采集之王[合].js

@@ -1,7 +1,15 @@
 /**
  * 强烈推荐静态分类。可以加快速度!!!
+ * 不建议:
  * 传参 ?type=url&params=../json/采集.json
- * 传参 ?type=url&params=../json/采集静态.json
+ * 建议:
+ * 传参 ?type=url&params=../json/采集静态.json#1
+ * 传参 ?type=url&params=../json/采集[zy]静态.json#1
+ * 传参 ?type=url&params=../json/采集[密]静态.json#1
+ * hipy-server支持@改名比如:
+ * 传参 ?type=url&params=../json/采集静态.json#1@采王道长[合]
+ * 传参 ?type=url&params=../json/采集[zy]静态.json#1@采王zy[密]
+ * 传参 ?type=url&params=../json/采集[密]静态.json@采王成人[密]
  * [{"name":"暴风资源","url":"https://bfzyapi.com","parse_url":""},{"name":"飞刀资源","url":"http://www.feidaozy.com","parse_url":""},{"name":"黑木耳资源","url":"https://www.heimuer.tv","parse_url":""}]
  */
 globalThis.getRandomItem = function (items) {//从列表随机取出一个元素
@@ -10,8 +18,11 @@ globalThis.getRandomItem = function (items) {//从列表随机取出一个元素
 var rule = {
     title: '采集之王[合]',
     author: '道长',
-    version: '20240703 beta10',
+    version: '20240705 beta13',
     update_info: `
+20240705:
+1.支持传参json后面增加#1 这样的额外标识,用于搜索结果精准匹配
+2.支持传参json后面增加#1#1 这样的额外标识,用于强制获取搜索图片。#1#不显示图片。默认是搜索强制有图片的[待实现详情页请求使用批量]
 20240703:
 1.采集json支持"searchable": 0,用于搜索时排除这个源
 20240604:
@@ -21,7 +32,7 @@ var rule = {
 有些资源站的json接口不是标准的/api.php/provide/vod/,需要自己在采集静态.json中编辑对应的api属性填写比如:/api.php/provide/vod/at/json/
 有些资源站的采集数据是加密后的切片片段,可能需要采集站特定的解析接口,需要自己编辑json里的parse_url属性
 资源站部分大分类下无数据很正常,可以自行编辑json里cate_exclude属性排除掉自己测试过无数据的分类(小程序无法自动识别,只能人工测好哪些分类无数据)
-`,
+`.trim(),
     host: '',
     homeTid: '', // 首页推荐。一般填写第一个资源站的想要的推荐分类的id.可以空
     homeUrl: '/api.php/provide/vod/?ac=detail&t={{rule.homeTid}}',
@@ -39,8 +50,11 @@ var rule = {
     filterable: 1,//是否启用分类筛选,
     play_parse: true,
     parse_url: '', // 这个参数暂时不起作用。聚合类的每个资源应该有自己独立的解析口。单独配置在采集.json里的parse_url有效
+    search_match: false, // 搜索精准匹配
+    search_pic: true, // 搜索强制需要图片
     // params: 'http://127.0.0.1:5707/files/json/%E9%87%87%E9%9B%86.json',
-    // params: 'http://127.0.0.1:5707/files/json/采集静态.json',
+    // params: 'http://127.0.0.1:5707/files/json/采集静态.json#1',
+    // params: 'http://127.0.0.1:5707/files/json/采集[zy]静态.json#1',
     // hostJs:$js.toString(()=>{
     //
     // }),
@@ -76,6 +90,14 @@ var rule = {
         }
         let _url = rule.params;
         if (_url && typeof (_url) === 'string' && /^(http|file)/.test(_url)) {
+            if (_url.includes('#')) {
+                let _url_params = _url.split('#');
+                _url = _url_params[0];
+                rule.search_match = !!(_url_params[1]);
+                if (_url_params.length > 2) { // 强制图片
+                    rule.search_pic = !!(_url_params[2]);
+                }
+            }
             let html = request(_url);
             let json = JSON.parse(html);
             let _classes = [];
@@ -280,7 +302,28 @@ var rule = {
                                         i.vod_id = it.type_id + '$' + i.vod_id;
                                         i.vod_remarks = i.vod_remarks + '|' + it.type_name;
                                     });
-                                    results = results.concat(data);
+                                    if (rule.search_match) {
+                                        data = data.filter(item => item.vod_name && (new RegExp(KEY, 'i')).test(item.vod_name))
+                                    }
+                                    if (data.length > 0) {
+                                        if (rule.search_pic && !data[0].vod_pic) {
+                                            log(`当前搜索站点【${it.type_name}】没图片,尝试访问二级去获取图片`);
+                                            let detailUrl = urls[idx].split('wd=')[0] + 'ac=detail&ids=' + data.map(k => k.vod_id.split('$')[1]).join(',');
+                                            try {
+                                                let detailJson = JSON.parse(request(detailUrl));
+                                                data.forEach((d, _seq) => {
+                                                    log('二级数据列表元素数:' + detailJson.list.length);
+                                                    let detailVodPic = detailJson.list[_seq].vod_pic;
+                                                    if (detailVodPic) {
+                                                        Object.assign(d, {vod_pic: detailVodPic});
+                                                    }
+                                                });
+                                            } catch (e) {
+                                                log(`强制获取网站${it.type_id}的搜索图片失败:${e.message}`);
+                                            }
+                                        }
+                                        results = results.concat(data);
+                                    }
                                 } catch (e) {
                                     log(`请求:${it.type_id}发生错误:${e.message}`)
                                 }
@@ -297,6 +340,28 @@ var rule = {
                                     i.vod_id = it.type_id + '$' + i.vod_id;
                                     i.vod_remarks = i.vod_remarks + '|' + it.type_name;
                                 });
+                                if (rule.search_match) {
+                                    data = data.filter(item => item.vod_name && (new RegExp(KEY, 'i')).test(item.vod_name))
+                                }
+                                if (data.length > 0) {
+                                    if (rule.search_pic && !data[0].vod_pic) {
+                                        log(`当前搜索站点【${it.type_name}】没图片,尝试访问二级去获取图片`);
+                                        let detailUrl = urls[idx].split('wd=')[0] + 'ac=detail&ids=' + data.map(k => k.vod_id.split('$')[1]).join(',');
+                                        try {
+                                            let detailJson = JSON.parse(request(detailUrl));
+                                            data.forEach((d, _seq) => {
+                                                log('二级数据列表元素数:' + detailJson.list.length);
+                                                let detailVodPic = detailJson.list[_seq].vod_pic;
+                                                if (detailVodPic) {
+                                                    Object.assign(d, {vod_pic: detailVodPic});
+                                                }
+                                            });
+                                        } catch (e) {
+                                            log(`强制获取网站${it.type_id}的搜索图片失败:${e.message}`);
+                                        }
+                                    }
+                                    results = results.concat(data);
+                                }
                                 results = results.concat(data);
                             } catch (e) {
                                 log(`请求:${it.type_id}发生错误:${e.message}`)

File diff suppressed because it is too large
+ 3 - 10
app/t4/files/drpy_js/阿里土豆[盘].js


+ 4 - 3
app/t4/files/index.js

@@ -160,10 +160,11 @@ async function main() {
             extras = ['?type=url&params=../json/小学教育.json'];
         } else if (rname.includes('采集之王')) {
             extras = [
-                '?type=url&params=../json/采集静态.json',
-                '?type=url&params=../json/采集[密]静态.json',
+                '?type=url&params=../json/采集静态.json#1',
+                '?type=url&params=../json/采集[密]静态.json#1',
+                '?type=url&params=../json/采集[zy]静态.json#1',
             ];
-        }else if (rname.includes('直播转点播')) {
+        } else if (rname.includes('直播转点播')) {
             extras = [
                 '?type=url&params=../json/live2cms.json',
             ];

+ 8 - 8
app/t4/files/txt/config.txt

@@ -8,9 +8,9 @@
 "homeLogo":"{{host}}/static/img/logo500x200-1.png",
 "sites": [{% for rule in rules %}{% if rule.file_type ==".py" %}
 {
-    "key":"{% if mode == 0 %}hipy_t4_{{ rule.name }}{% else %}hipy_t3_{{ rule.name }}{% endif %}",
-    "key":"hipy_py_{{ rule.name }}",
-    "name":"{% if mode == 0 %}{{ rule.name }}(hipy_t4){% else %}{{ rule.name }}(hipy_t3){% endif %}",
+    "key":"{% if mode == 0 %}hipy_t4_{{ rule.ext_name }}{% else %}hipy_t3_{{ rule.ext_name }}{% endif %}",
+    "key":"hipy_py_{{ rule.ext_name }}",
+    "name":"{% if mode == 0 %}{{ rule.ext_name }}(hipy_t4){% else %}{{ rule.ext_name }}(hipy_t3){% endif %}",
     "type":{% if mode == 0 %}4{% else %}3{% endif %},
     "api":"{% if mode == 0 %}{{ host }}/api/v1/vod/{{ rule.name }}{% if config.vod_passwd %}?pwd={{config.vod_passwd}}{% endif %}{% else %}{{ host }}/files/hipy/{{ rule.name }}{{rule.file_type}}{% endif %}",
     "searchable": {{ rule.searchable or 0 }},
@@ -20,11 +20,11 @@
     "ext": "{{ rule.ext or ""}}"
 }{% else %}
 {
-    "key":"dr_{{ rule.name }}",
-    "key":"{% if mode == 0 %}drpy_t4_{{ rule.name }}{% else %}drpy_t3_{{ rule.name }}{% endif %}",
-    "key":"hipy_js_{{ rule.name }}",
-    "name":"{{ rule.name }}(drpy)",
-    "name":"{% if mode == 0 %}{{ rule.name }}(drpy_t4){% else %}{{ rule.name }}(drpy_t3){% endif %}",
+    "key":"dr_{{ rule.ext_name }}",
+    "key":"{% if mode == 0 %}drpy_t4_{{ rule.ext_name }}{% else %}drpy_t3_{{ rule.ext_name }}{% endif %}",
+    "key":"hipy_js_{{ rule.ext_name }}",
+    "name":"{{ rule.ext_name }}(drpy)",
+    "name":"{% if mode == 0 %}{{ rule.ext_name }}(drpy_t4){% else %}{{ rule.ext_name }}(drpy_t3){% endif %}",
     "type":3,
     "type":{% if mode == 0 %}4{% else %}3{% endif %},
     "api":"{{ config.vod_drpy_api }}",

+ 22 - 22
app/t4/files/txt/pg.conf

@@ -10,28 +10,28 @@
    "drives": [{"name":"阿里","password":"43886374072944a2bcc55a0ed129ab48","type":"alidrive"}],
 #  "lives":[{"group":"redirect","channels":[{"name":"我的直播","urls":["proxy://do=live&type=txt&ext={{host}}/files/txt/zb.txt"]}]}],
    "sites":[
-   {
-      "key": "hipy_js_采集之王[合]1",
-      "name": "采集之王[合](采集[密]静态)",
-      "type": 3,
-      "api": "{{host}}/files/drpy_libs/drpy2.min.js",
-      "searchable": 1,
-      "quickSearch": 1,
-      "filterable": 1,
-      "order_num": 463,
-      "ext": "{{host}}/files/drpy_js/采集之王[合].js?type=url&params=../json/采集[密]静态.json"
-   },
-   {
-      "key": "hipy_js_采集之王[合]2",
-      "name": "采集之王[合](采集[zy]静态)",
-      "type": 3,
-      "api": "{{host}}/files/drpy_libs/drpy2.min.js",
-      "searchable": 1,
-      "quickSearch": 1,
-      "filterable": 1,
-      "order_num": 463,
-      "ext": "{{host}}/files/drpy_js/采集之王[合].js?type=url&params=../json/采集[zy]静态.json"
-   },
+#    {
+#       "key": "hipy_js_采集之王[合]01",
+#       "name": "采集之王[合](采集[密]静态)",
+#       "type": 3,
+#       "api": "{{host}}/files/drpy_libs/drpy2.min.js",
+#       "searchable": 1,
+#       "quickSearch": 1,
+#       "filterable": 1,
+#       "order_num": 463,
+#       "ext": "{{host}}/files/drpy_js/采集之王[合].js?type=url&params=../json/采集[密]静态.json"
+#    },
+#    {
+#       "key": "hipy_js_采集之王[合]02",
+#       "name": "采集之王[合](采集[zy]静态)",
+#       "type": 3,
+#       "api": "{{host}}/files/drpy_libs/drpy2.min.js",
+#       "searchable": 1,
+#       "quickSearch": 1,
+#       "filterable": 1,
+#       "order_num": 463,
+#       "ext": "{{host}}/files/drpy_js/采集之王[合].js?type=url&params=../json/采集[zy]静态.json#1"
+#    },
  {"key":"Test_jsapi","name":"Test_jsapi(drpy)","type":3,"api":"{{ config.vod_drpy_api }}","searchable":2,"quickSearch":0,"filterable":0,"ext":"{{host}}/files/txt/js/jsapi.js","jar":"{{host}}/files/jar/custom_jsapi.jar"},
 # 缓存js
  {"key":"js_origin","name":"JS(原始)","type":3,"api":"{{host}}/files/txt/js/原始JS.js","searchable":1,"quickSearch":1,"filterable":1,"ext":""},

Some files were not shown because too many files changed in this diff