From 03094adb806933fdb89146ac9a57708db85c4375 Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Sat, 27 Aug 2022 22:50:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=93=9D=E8=8E=93=E5=BD=B1=E8=A7=86=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E9=A6=96=E9=A1=B5=E5=92=8C=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 13 ++++++- ...35\350\216\223\345\275\261\350\247\206.js" | 11 +++++- models/rules.db | Bin 12288 -> 12288 bytes templates/rules.html | 35 +++++++++++++++++- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 35f9799..ea9f223 100644 --- a/app.py +++ b/app.py @@ -165,9 +165,20 @@ def getClassInfoApi(cls): info = getClassInfo(cls) return jsonify({'msg':info}) +@app.route('/clearcls/') +def clearClassApi(cls): + logger.info(f'开始查询{cls}的分类详情') + res = db.session.query(RuleClass).filter(RuleClass.name == cls) + if res: + res.delete() + db.session.commit() + return jsonify(error.success(f'已清除{cls}的分类缓存')) + else: + return jsonify(error.failed(f'数据库不存在{cls}的分类缓存')) + @app.route('/rules') def rules(): - return render_template('rules.html',rules=getRules()) + return render_template('rules.html',rules=getRules(),classes=getClasses()) @app.route('/raw') def rules_raw(): diff --git "a/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" "b/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" index 9ae1c3a..500939d 100644 --- "a/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" +++ "b/js/\350\223\235\350\216\223\345\275\261\350\247\206.js" @@ -3,9 +3,16 @@ var rule = { host:'https://lanmeiguojiang.com', // homeUrl:'/', url:'/show/fyclass--------fypage---.html', + headers:{ + 'User-Agent':'MOBILE_UA' + }, searchUrl:'/vodsearch/**----------fypage---.html', - class_name:'电影&网剧&剧集&动漫&综艺&记录', - class_url:'20&1&2&3&4&23', + // class_name:'电影&网剧&剧集&动漫&综艺&记录', + // class_url:'20&1&2&3&4&23', + class_parse:'.navbar-items li:gt(1):lt(8);a&&Text;a&&href;/(\\d+).html', + limit:5, + 推荐:'.tab-list.active;a.module-poster-item.module-item;.module-poster-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href', + double:true, // 推荐内容是否双层定位 一级:'body a.module-poster-item.module-item;a&&title;.lazyload&&data-original;.module-item-note&&Text;a&&href', 二级:{"title":"h1&&Text;.module-info-tag&&Text","img":".lazyload&&data-original","desc":".module-info-item:eq(1)&&Text;.module-info-item:eq(2)&&Text;.module-info-item:eq(3)&&Text","content":".module-info-introduction&&Text","tabs":".module-tab-item","lists":".module-play-list:eq(#id) a"}, 搜索:'body .module-item;.module-card-item-title&&Text;.lazyload&&data-original;.module-item-note&&Text;a&&href;.module-info-item-content&&Text', diff --git a/models/rules.db b/models/rules.db index f126d74e8c769d6c173999dd531e00dc1aa775ef..744ddee2212c45a3bff812f6e445a484223303f5 100644 GIT binary patch delta 175 zcmZojXh@hK%_uNY#+gxIW5Pmye*Ss}W?ml#ersMI{_VUz8w+iCH~YvMGqEr*Fj!1( zmN$uXXJutjjaPp$dG3q8$xruge6hUk`QC|7JD00HpRyImR|7I%&TdnC+O^`@p4Dp4 zckg-8xl8T&u2oO>PBk)6GgLEDGgdQEGcxAlf5E`ae};koF8>++_xxuz3o7j9pL|+h TRsv`jdvboZ0JAD1vNfy#uq8&D delta 175 zcmZojXh@hK&B#4b#+i|OW5Pmyeg*~x7G56){sa8={MNia8w+iCH~YvMGqKn+u`*0< zmN$tsRWnjER5MXCwqs;vkPlZjH8p*@cjJrYZO^A{1v1oL?4S31_u8kO%hjGQ>wns@ zQtfHiif4OPt3BVn=SAl(Ly&GG6Oeu`kX`&|82CT)zu>>ie`d3w!fyV_r}bqexR@mw Slk>AvbIX``nB_U)HUIz+dp^Yg diff --git a/templates/rules.html b/templates/rules.html index d973b92..d516343 100644 --- a/templates/rules.html +++ b/templates/rules.html @@ -37,9 +37,24 @@ } }); + + $(".cls").click(function(){ + let cls = this.innerText.trim(); + if(confirm('确认清除规则'+cls+'缓存的分类?')){ + let code = $.ajax({url:"/clearcls/"+cls,async:false}).responseText; + code = typeof(code) === "object"?code:JSON.parse(code); + if(code.code === 200){ + alert('操作成功!\n'+code.msg); + location.reload() + }else{ + alert('操作失败!\n'+code.msg); + } + } + }); }); +

缓存规则列表

{% if rules.count < 1 %}

暂无已缓存的规则

{% endif %} @@ -62,7 +77,25 @@ {% endif %} - {% endfor %} + {% endfor %} + +

缓存分类列表

+{% if classes|length < 1 %} +

暂无已缓存的分类

+{% endif %} +{% for cls in classes %} + {% if cls|length > 2 %} +
  • + {{ cls }} +
  • + + {% else %} +
  • + {{ cls }} +
  • + + {% endif %} + {% endfor %} \ No newline at end of file -- GitLab