Skip to content

Instantly share code, notes, and snippets.

@linnchord
Last active June 20, 2022 07:15
Show Gist options
  • Save linnchord/301fe49b91b0e1585397854aff068c3a to your computer and use it in GitHub Desktop.
Save linnchord/301fe49b91b0e1585397854aff068c3a to your computer and use it in GitHub Desktop.
yaml profiles parser of clash for TDY clash service to filter "10x 20x" proxy
# Clash win desktop op
# Settings > Profiles > Parsers > Edit
# => copy & past & update the {{token url}} & close & update subscribe
parsers: # array
- url: {{ you tdy token url https://subscribe.*** }}
yaml:
prepend-rules:
- 'DOMAIN-SUFFIX,epicgames.com,POTATO CLOUD'
- 'DOMAIN-SUFFIX,epicgames.dev,POTATO CLOUD'
- 'DOMAIN-SUFFIX,microsoft.com,POTATO CLOUD'
code: | # script for filter 10x 20x proxy
module.exports.parse = async (raw, { axios, yaml, notify, console }, { name, url, interval, selected }) => {
let o = yaml.parse(raw)
let p = []
let fp = []
for (let i in o.proxies){
if(o.proxies[i].name.search(/丨\d+x/ig) == -1){
p.push(o.proxies[i])
}
else{
fp.push(o.proxies[i].name)
}
}
o.proxies = p
if(fp.length > 0){
let pg = o["proxy-groups"]
for(let i in pg){
pg[i].proxies = pg[i].proxies.filter(_ => !fp.includes(_))
}
}
return yaml.stringify(o)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment