├── node ├── README.md ├── ClashNode.yaml └── NodeFree.yaml ├── .gitignore ├── package.json ├── refreshcdn.js ├── fixscript.js ├── utils.js ├── .github └── workflows │ ├── update-node.yml │ ├── update-vpnode.yml │ └── merge.yml ├── merge.js ├── index.js ├── README.md ├── vpnoe.js └── LICENSE /node/README.md: -------------------------------------------------------------------------------- 1 | This node list -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .history 3 | yarn.lock 4 | package-lock.json -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fetch-clash-node", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "engines": { 7 | "node": ">=18" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "yaml": "^2.2.1" 16 | } 17 | } -------------------------------------------------------------------------------- /refreshcdn.js: -------------------------------------------------------------------------------- 1 | (async () => { 2 | const host = "https://purge.jsdelivr.net/gh/itxve/fetch-clash-node/node/"; 3 | 4 | await Promise.all( 5 | [ 6 | "ClashNode.yaml", 7 | "NodeFree.yaml", 8 | "NodeShare.yaml", 9 | "merge.yaml", 10 | "vpnoe.yaml", 11 | ].map((node) => { 12 | fetch(host + node).then(async (res) => { 13 | if (res.status === 200) { 14 | console.log(node, ":ok", await res.text()); 15 | } 16 | }); 17 | }) 18 | ); 19 | })(); 20 | -------------------------------------------------------------------------------- /fixscript.js: -------------------------------------------------------------------------------- 1 | // 未使用的脚本 2 | const YAML = require("yaml"); 3 | const fs = require("fs"); 4 | const path = require("path"); 5 | 6 | try { 7 | const doc = YAML.parse( 8 | fs 9 | .readFileSync(path.join(__dirname, "node", "ClashNode.yaml"), "utf-8") 10 | // 过滤不支持的标签 11 | .replace("!", "") 12 | ); 13 | doc["proxies"] = [].concat(doc["proxies"]).filter((it) => it.port == 11023); 14 | 15 | fs.writeFileSync( 16 | path.join(__dirname, "node", "ClashNode2.yaml"), 17 | YAML.stringify(doc) 18 | ); 19 | } catch (e) { 20 | console.log(e); 21 | } 22 | -------------------------------------------------------------------------------- /utils.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | function zore(t) { 4 | return t >= 10 ? `${t}` : `0${t}`; 5 | } 6 | function rf(name) { 7 | const filePath = path.join(__dirname, "node", name); 8 | if (fs.existsSync(filePath)) { 9 | return fs.readFileSync(filePath).toString(); 10 | } else { 11 | return ""; 12 | } 13 | } 14 | function wf(name, data) { 15 | fs.writeFileSync(path.join(__dirname, "node", name), data); 16 | } 17 | function readme() { 18 | return fs.readFileSync(path.join(__dirname, "README.md")).toString(); 19 | } 20 | function wreadme(data) { 21 | return fs.writeFileSync(path.join(__dirname, "README.md"), data); 22 | } 23 | 24 | module.exports = { rf, zore, wf, readme, wreadme }; 25 | -------------------------------------------------------------------------------- /.github/workflows/update-node.yml: -------------------------------------------------------------------------------- 1 | # Update subscription links 2 | name: Daily Update 3 | 4 | on: 5 | # 8-20 beijin 6 | # Runs at 0-12 UTC every day 7 | schedule: 8 | - cron: "0 0-16 * * *" 9 | 10 | # Manual updates 11 | workflow_dispatch: 12 | 13 | jobs: 14 | update: 15 | runs-on: ubuntu-latest 16 | steps: 17 | # Checks-out the repository under $GITHUB_WORKSPACE 18 | - uses: actions/checkout@v3 19 | - uses: actions/setup-node@v3 20 | with: 21 | node-version: 18 22 | - name: Fetch Free Clash Node 23 | run: node index.js 24 | - name: Refresh CDN 25 | run: node refreshcdn.js 26 | - name: Commit Newest Node 27 | # Condition to prevent unintended automatic workflow 28 | # Change or comment out this line for automatic workflow on forks 29 | if: ${{ github.repository == 'itxve/fetch-clash-node' }} 30 | run: | 31 | git config --global user.name "GitHub Action" 32 | git config --global user.email "action@github.com" 33 | git add ./node README.md 34 | git commit -m "update node" && git push || echo "no change" 35 | -------------------------------------------------------------------------------- /.github/workflows/update-vpnode.yml: -------------------------------------------------------------------------------- 1 | # Update subscription links 2 | name: Daily Update vpnode 3 | 4 | on: 5 | # 8-20 beijin 6 | # Runs at 0-12 UTC every day 7 | schedule: 8 | - cron: "0 2-4 * * *" 9 | 10 | # Manual updates 11 | workflow_dispatch: 12 | 13 | jobs: 14 | update: 15 | runs-on: ubuntu-latest 16 | steps: 17 | # Checks-out the repository under $GITHUB_WORKSPACE 18 | - uses: actions/checkout@v3 19 | - uses: actions/setup-node@v3 20 | with: 21 | node-version: 18 22 | - name: Fetch vpnoe 23 | run: node vpnoe.js 24 | - name: Refresh CDN 25 | run: node refreshcdn.js 26 | - name: Commit Newest Node 27 | # Condition to prevent unintended automatic workflow 28 | # Change or comment out this line for automatic workflow on forks 29 | if: ${{ github.repository == 'itxve/fetch-clash-node' }} 30 | run: | 31 | git config --global user.name "GitHub Action" 32 | git config --global user.email "action@github.com" 33 | git add ./node README.md 34 | git commit -m "update node" && git push || echo "no change" 35 | -------------------------------------------------------------------------------- /.github/workflows/merge.yml: -------------------------------------------------------------------------------- 1 | # Update subscription links 2 | name: Daily Merge 3 | 4 | on: 5 | # 8-20 beijin 6 | # Runs at 0-12 UTC every day 慢于 Daily Update 任务 7 | schedule: 8 | - cron: "5 0-16 * * *" 9 | 10 | # Manual updates 11 | workflow_dispatch: 12 | 13 | jobs: 14 | update: 15 | runs-on: ubuntu-latest 16 | steps: 17 | # Checks-out the repository under $GITHUB_WORKSPACE 18 | - uses: actions/checkout@v3 19 | - uses: actions/setup-node@v3 20 | with: 21 | node-version: 18 22 | - name: Merge Clash Node 23 | run: node merge.js 24 | - name: Refresh CDN 25 | run: node refreshcdn.js 26 | - name: Commit Newest Node 27 | # Condition to prevent unintended automatic workflow 28 | # Change or comment out this line for automatic workflow on forks 29 | if: ${{ github.repository == 'itxve/fetch-clash-node' }} 30 | run: | 31 | git config --global user.name "GitHub Action" 32 | git config --global user.email "action@github.com" 33 | git add ./node README.md 34 | git commit -m "update node" && git push || echo "no change" 35 | -------------------------------------------------------------------------------- /merge.js: -------------------------------------------------------------------------------- 1 | const { wf } = require("./utils"); 2 | 3 | const urls = [ 4 | "https://raw.githubusercontent.com/itxve/fetch-clash-node/main/node/ClashNode.yaml", 5 | "https://raw.githubusercontent.com/itxve/fetch-clash-node/main/node/NodeFree.yaml", 6 | "https://raw.githubusercontent.com/itxve/fetch-clash-node/main/node/NodeShare.yaml", 7 | ].join("|"); 8 | 9 | const subscriptUrl = `https://api.subcsub.com/sub?target=clash&url=${encodeURIComponent( 10 | urls 11 | )}&insert=false`; 12 | 13 | console.log(subscriptUrl); 14 | 15 | (async () => { 16 | const res = await fetch(subscriptUrl, { 17 | headers: { 18 | accept: 19 | "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", 20 | "accept-language": "zh-CN,zh;q=0.9,ga;q=0.8", 21 | "cache-control": "max-age=0", 22 | priority: "u=0, i", 23 | "sec-ch-ua": 24 | '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"', 25 | "sec-ch-ua-mobile": "?0", 26 | "sec-ch-ua-platform": '"macOS"', 27 | "sec-fetch-dest": "document", 28 | "sec-fetch-mode": "navigate", 29 | "sec-fetch-site": "none", 30 | "sec-fetch-user": "?1", 31 | "upgrade-insecure-requests": "1", 32 | }, 33 | referrerPolicy: "strict-origin-when-cross-origin", 34 | body: null, 35 | method: "GET", 36 | }).then((res) => res.text()); 37 | if (res) { 38 | wf(`merge.yaml`, res); 39 | } 40 | })(); 41 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const { rf, zore, wf, readme, wreadme } = require("./utils"); 2 | 3 | function update_read_me() { 4 | let read = readme(); 5 | let update_readme = read.replace( 6 | /