Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Latest commit

 

History

History
94 lines (62 loc) · 3.05 KB

README.md

File metadata and controls

94 lines (62 loc) · 3.05 KB

Update resources in clash configuration

说明

通过代理更新 Clash 配置的网络资源, 所以前提是可以翻墙后, 再使用该工具。通常是有一个可以翻墙的 Clash 配置, 再使用该工具。

写这个工具的原因:

太多以上的之类的问题了。

我写的一个 clash-auto 可以通过自身代理来更新 Clash 配置依赖的资源。

update_clashcfg_res

Requires

平台: Linux/Windows

依赖:

pip install ruamel.yaml requests

安装和使用

git clone https://github.com/JohanChane/update-clash-resources.git --depth 1
cd update-clash-resources/update_clashcfg_res
python ./update_clashcfg_res.py -h

Examples

更新 Windows 平台的 Clash for Windows 的配置:

# 更新 list 所选的配置的资源。当加载出错时,list 的 index 会是 -1,所以要在没有出错前,运行该程序。
update_clashcfg_res.py -d 'C:/Users/johan/.config/clash' -p 'C:/Users/johan/.config/clash/profiles' -P 'https://127.0.0.1:7890' --is-cfw -n 'config.yaml' -r

更新 Linux 平台的 Clash 的配置:

update_clashcfg_res.py -d ~/.config/clash -p ~/.config/clash -P 'https://127.0.0.1:7890' -n 'config.yaml' -r
update_clashcfg_res.py -d ~/.config/clash -p ~/.config/clash -P 'https://127.0.0.1:7890' -n 'config.yaml' -u '<url>' -r
update_clashcfg_res.py -d ~/.config/clash -p ~/.config/clash -P 'https://127.0.0.1:7890' -n 'config.yaml' -u '$(cat ~/.config/clash_tun/config_url)' -r

更新 Linux 平台的 Clash Tun 的配置:

# 将更新的文件安装到 tun_dir
update_clashcfg_res.py -d 'C:/Users/johan/.config/clash' -n 'myconfig' -P 'https://127.0.0.1:7890' -T '/srv/clash' -r

使用 SubConverter Host (订阅转换的后端地址): 如果发现 url 的内容不是 Clash 的配置, 则使用订阅转换。

update_clashcfg_res.py -d 'C:/Users/johan/.config/clash' -n 'myconfig' -P 'https://127.0.0.1:7890' -H 'sub.xeton.dev' -r

update_clashcfg_res 的进阶用法

my_up_clashcfg_res.py

该脚本的作用: 使用 update_clashcfg_res 时需要输入太多的参数, 而通常每次参数都是一样的, 所以可以在该脚本可以设置一些自己常用的参数。 是会使用 cfg_dir 的默认位置更新资源。

比如: my_up_clashcfg_res.py

# In Linux
./my_up_clashcfg_res.py -n config.yaml -r

# In Windows
python ./my_up_clashcfg_res.py -n config.yaml -r

如果参数有空格:

# In PowerShell
python ./my_up_clashcfg_res.py -n '\"my config\"' -r

IccRes

IccRes