From e13cb86805e94fcf166c964f4ff33da1cb49a8a2 Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Tue, 13 Sep 2022 09:39:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/alist.conf | 26 +++++++++++++++ "base/\350\247\243\346\236\220.conf" | 3 +- utils/files.py | 47 +++++++++++++++++----------- 3 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 base/alist.conf diff --git a/base/alist.conf b/base/alist.conf new file mode 100644 index 0000000..b0261b5 --- /dev/null +++ b/base/alist.conf @@ -0,0 +1,26 @@ +# c=[];for(let i in a){c.push(i+','+a[i])}d=c.join('\n');console.log(d); +🔮嗨翻,https://pan.hikerfans.com +🦀9T(Adult),https://drive.9t.ee +🐱梓澪の妙妙屋,https://xn--i0v44m.xyz +🚆资源小站,https://pan.142856.xyz +🌤晴园的宝藏库,https://alist.52qy.repl.co +🐭米奇妙妙屋,https://anime.mqmmw.ga +💂小兵组网盘影视,https://6vv.app +📀小光盘,https://alist.xiaoguanxiaocheng.life +🐋一只鱼,https://alist.youte.ml +🌊七米蓝,https://al.chirmyram.com +🌴非盘,http://www.feifwp.top +🥼帅盘,https://hi.shuaipeng.wang +🐉神族九帝,https://alist.shenzjd.com +☃姬路白雪,https://pan.jlbx.xyz +🎧听闻网盘,https://wangpan.sangxuesheng.com +💾DISK,http://124.222.140.243:8080 +🌨云播放,https://quanzi.laoxianghuijia.cn +✨星梦,https://pan.bashroot.top +🌊小江,https://dyj.me +💫触光,https://pan.ichuguang.com +🕵好汉吧,https://8023.haohanba.cn +🥗AUNEY,http://121.227.25.116:8008 +🎡资源小站,https://960303.xyz/ +🏝fenwe,http://www.fenwe.tk:5244 +🎢轻弹浅唱,https://g.xiang.lol \ No newline at end of file diff --git "a/base/\350\247\243\346\236\220.conf" "b/base/\350\247\243\346\236\220.conf" index bf49ac2..3b47e5b 100644 --- "a/base/\350\247\243\346\236\220.conf" +++ "b/base/\350\247\243\346\236\220.conf" @@ -2,5 +2,4 @@ # 0123,对应,普通解析,json解析,并发多json解析,聚合解析,参数3不填默认0 # flags是线路名称标识,会自动拦截并走以下的解析 # 名称,链接,类型,ua (ua不填默认 Mozilla/5.0) 可以手动填 Dart/2.14 (dart:io) -虾米,https://dm.xmflv.com:4433/?url= - \ No newline at end of file +虾米,https://dm.xmflv.com:4433/?url= \ No newline at end of file diff --git a/utils/files.py b/utils/files.py index 4deb9c4..2d4d125 100644 --- a/utils/files.py +++ b/utils/files.py @@ -5,6 +5,8 @@ # Date : 2022/9/6 import os +import shutil + from utils.system import getHost from utils.encode import base64Encode from controllers.service import storage_service @@ -34,25 +36,32 @@ def get_live_url(new_conf,mode): def getAlist(): base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录 alist_path = os.path.join(base_path, 'js/alist.conf') - with open(alist_path,encoding='utf-8') as f: - data = f.read().strip() - alists = [] - for i in data.split('\n'): - i = i.strip() - dt = i.split(',') - if not i.strip().startswith('#'): - obj = { - 'name': dt[0], - 'server': dt[1], - 'type':"alist", - } - if len(dt) > 2: - obj.update({ - 'password': dt[2] - }) - alists.append(obj) - print(f'共计{len(alists)}条alist记录') - return alists + alist_cpath = os.path.join(base_path, 'base/alist.conf') + try: + if not os.path.exists(alist_cpath): + shutil.copy(alist_path, alist_cpath) # 复制文件 + with open(alist_cpath,encoding='utf-8') as f: + data = f.read().strip() + alists = [] + for i in data.split('\n'): + i = i.strip() + dt = i.split(',') + if not i.strip().startswith('#'): + obj = { + 'name': dt[0], + 'server': dt[1], + 'type':"alist", + } + if len(dt) > 2: + obj.update({ + 'password': dt[2] + }) + alists.append(obj) + print(f'共计{len(alists)}条alist记录') + return alists + except Exception as e: + print(f'获取alist列表失败:{e}') + return [] def custom_merge(original:dict,custom:dict): """ -- GitLab