id: 97c6261d0bc741769481922a64396df0
parent_id: 
item_type: 1
item_id: 25a24d2d84c64f319918facb62e61fd6
item_updated_time: 1764345476012
title_diff: "[{\"diffs\":[[1,\"分享一个parser，实现自动替换订阅规则，完全使用自己的规则，自由切换黑白名单。 - g\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":45}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>分享一个parser，实现自动替换订阅规则，完全使用自己的规则，自由切换黑白名单。 - githubmemory</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"7703\\\"></a>\\\r\\\n<h1>分享一个parser，实现自动替换订阅规则，完全使用自己的规则，自由切换黑白名单。 - githubmemory</h1>\\\r\\\n\\\r\\\n<div><span>\\\n  <div style=\\\"--en-clipped-content:simplified; --en-clipped-source-url:https://githubmemory.com/repo/Fndroid/clash_for_windows_pkg/issues/2193; --en-clipped-source-title:分享一个parser，实现自动替换订阅规则，完全使用自己的规则，自由切换黑白名单。 - githubmemory;\\\">\\\n<div><br/></div><div style=\\\"min-height: 6242px; font-size: 16px; display: block; min-width: 100%;\\\"> <div style=\\\"background-color:transparent;font:inherit;vertical-align:baseline;\\\"><div style=\\\"background-color:transparent;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;font-size:16px;line-height:1.5em;color:rgb(31, 9, 9);text-align:left;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;width:36em;z-index:200;padding-left:2em;padding-right:2em;margin-left:auto;margin-right:auto;position:relative;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;margin-left:-25px;margin-right:25px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;padding-top:0px;padding-bottom:9em;position:relative;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><h1 style=\\\"font-family:&quot;PT Serif&quot;;text-align:left;border:0px;font:inherit;vertical-align:baseline;font-size:35px;font-weight:normal;line-height:35px;margin-bottom:20px;padding:0px;margin:0px;\\\">分享一个parser，实现自动替换订阅规则，完全使用自己的规则，自由切换黑白名单。#2193</h1><div style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;height:1em;line-height:1;text-align:center;margin:0px;padding-top:1.5em;padding-bottom:1.5em;margin-bottom:0px;\\\"><div style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;background:-webkit-linear-gradient(0deg, rgb(243, 242, 238) 1%, rgb(31, 9, 9) 50%, rgb(243, 242, 238) 99%);position:absolute;left:-4em;top:50%;z-index:10;width:100%;padding-left:4em;padding-right:4em;height:0.1em;opacity:0.5;margin:0px;margin-bottom:0px;\\\"><span style=\\\"font:inherit;position:absolute;left:-4em;top:50%;z-index:10;width:100%;padding-left:4em;padding-right:4em;height:0.1em;margin:0px;opacity:0.5;background:-webkit-linear-gradient(0deg, rgb(243, 242, 238) 1%, rgb(31, 9, 9) 50%, rgb(243, 242, 238) 99%);\\\"></span></div></div></div>\\\n<div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">\\\n<p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">听说CFW TUN模式可以实现真全局代理，于是从别的代理软件转来用CFW，发现clash的规则居然是机场提供的，各个机场的规则又参差不齐，用起来始终不能顺心。\\\n非重度用户，只想实现一个黑白名单的规则，又是强迫症，不需要订阅带的杂七杂八的一大堆策略。\\\n修改规则的话一更新订阅就没了，研究了老半天，发现可以通过parser实现，迷迷糊糊的，反正能用！\\\n用的是 Loyalsoldier/clash-rules 的规则集，收录的应该是很全了，而且每天更新。\\\n复制到预处理配置(Settings-Profiles-Parsers)里，更新订阅就好，会替换整个服务商的规则，下面规则可以自由切换黑白名单，给同是小白的人参考，直接用或者根据自己的需求修改。\\\n有三个不可选的套娃分组，如果想界面整洁一点，可以去设置里隐藏起来(Settings-Proxies-Hide Unselectable Group)</p>\\\n<pre style=\\\"background-color:rgb(243, 242, 238);font-family:Inconsolata;margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"font-family:Inconsolata;margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;line-height:1.71429em;font-size:1.15em;\\\">parsers: # array\\\n  # - reg: ^.*$ 匹配所有订阅，或  - url: https://example.com/profile.yaml 指定订阅\\\n  - reg: ^.*$\\\n  # 删除服务商提供的策略组和规则\\\n    code: |\\\n      module.exports.parse = (raw, { yaml }) =&gt; {\\\n        const rawObj = yaml.parse(raw)\\\n        const groups = []\\\n        const rules = []\\\n        return yaml.stringify({ ...rawObj, 'proxy-groups': groups, rules })\\\n      } \\\n  # 建立自己的配置\\\n    yaml:\\\n      prepend-proxy-groups: # 建立策略组\\\n        - name:  代理模式 \\\n          type: select\\\n          proxies:\\\n            - 绕过大陆丨黑名单(GFWlist) # 黑名单模式，意为「只有命中规则的网络流量，才使用代理」\\\n            - 绕过大陆丨白名单(Whitelist) # 白名单模式，意为「没有命中规则的网络流量，统统使用代理」\\\n            \\\n        - name:  选择节点 \\\n          type: select\\\n            \\\n        - name:  广告拦截\\\n          type: select\\\n          proxies:\\\n            - DIRECT\\\n            - REJECT\\\n            - PROXY\\\n            \\\n        - name: 绕过大陆丨黑名单(GFWlist)\\\n          type: url-test\\\n          url: http://www.gstatic.com/generate_204\\\n          interval: 86400\\\n          proxies:\\\n            - DIRECT\\\n            \\\n        - name: 绕过大陆丨白名单(Whitelist)\\\n          type: url-test\\\n          url: http://www.gstatic.com/generate_204\\\n          interval: 86400\\\n          proxies:\\\n            - PROXY\\\n            \\\n        - name: PROXY\\\n          type: url-test\\\n          url: http://www.gstatic.com/generate_204\\\n          interval: 86400\\\n          proxies:\\\n            -  选择节点\\\n            \\\n  # 策略组示例\\\n       # - name: 分组名\\\n         # type: select       # 手动选点   \\\n               # url-test     # 自动选择延迟最低的节点\\\n               # fallback     # 节点故障时自动切换下一个\\\n               # laod-balance # 均衡使用分组内的节点\\\n         # url: http://www.gstatic.com/generate_204 # 测试地址 非select类型分组必要\\\n         # interval: 300 # 自动测试间隔时间，单位秒 非select类型分组必要\\\n         # tolerance: 50 # 允许的偏差，节点之间延迟差小于该值不切换 非必要\\\n         # proxies:  \\\n           # - 节点名称或其他分组套娃\\\n          \\\n      commands:\\\n        - proxy-groups. 选择节点.proxies=[]proxyNames # 向指定策略组添加订阅中的节点名，可使用正则过滤\\\n        - proxy-groups. 选择节点.proxies.0+DIRECT # 向指定分组第一个位置添加一个 DIRECT 节点名\\\n        \\\n        # 一些可能用到的正则过滤节点示例，使分组更细致\\\n        # []proxyNames|a                         # 包含a\\\n        # []proxyNames|^(.*)(a|b)+(.*)$          # 包含a或b\\\n        # []proxyNames|^(?=.*a)(?=.*b).*$        # 包含a和b\\\n        # []proxyNames|^((?!b).)*a((?!b).)*$     # 包含a且不包含b\\\n        # []proxyNames|^((?!b|c).)*a((?!b|c).)*$ # 包含a且不包含b或c\\\n        \\\n  # 添加规则\\\n      prepend-rules: # 规则由上往下遍历，如上面规则已经命中，则不再往下处理\\\n        - RULE-SET,applications,DIRECT\\\n        - DOMAIN,clash.razord.top,DIRECT\\\n        - DOMAIN,yacd.haishan.me,DIRECT\\\n        - RULE-SET,private,DIRECT\\\n        - RULE-SET,reject, 广告拦截\\\n        - RULE-SET,icloud,DIRECT #\\\n        - RULE-SET,apple,DIRECT # 这三个为国内可直连地址，如果希望走代理改为PROXY\\\n        - RULE-SET,google,DIRECT # \\\n        - RULE-SET,tld-not-cn,PROXY\\\n        - RULE-SET,gfw,PROXY\\\n        - RULE-SET,greatfire,PROXY\\\n        - RULE-SET,telegramcidr,PROXY\\\n        - RULE-SET,lancidr,DIRECT\\\n        - RULE-SET,cncidr,DIRECT\\\n        - GEOIP,,DIRECT\\\n        - GEOIP,CN,DIRECT\\\n        - RULE-SET,direct,DIRECT\\\n        - RULE-SET,proxy, 代理模式\\\n        - MATCH, 代理模式 # 规则之外的\\\n  # 添加规则集\\\n      mix-rule-providers: \\\n        reject: # 广告域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt&quot;\\\n          path: ./ruleset/reject.yaml\\\n          interval: 86400\\\n          \\\n        icloud: # iCloud 域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt&quot;\\\n          path: ./ruleset/icloud.yaml\\\n          interval: 86400\\\n          \\\n        apple: # Apple 在中国大陆可直连的域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt&quot;\\\n          path: ./ruleset/apple.yaml\\\n          interval: 86400\\\n          \\\n        google: # Google 在中国大陆可直连的域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt&quot;\\\n          path: ./ruleset/google.yaml\\\n          interval: 86400\\\n          \\\n        proxy: # 代理域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt&quot;\\\n          path: ./ruleset/proxy.yaml\\\n          interval: 86400\\\n          \\\n        direct: # 直连域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt&quot;\\\n          path: ./ruleset/direct.yaml\\\n          interval: 86400\\\n          \\\n        private: # 私有网络专用域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt&quot;\\\n          path: ./ruleset/private.yaml\\\n          interval: 86400\\\n          \\\n        gfw: # GFWList 域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt&quot;\\\n          path: ./ruleset/gfw.yaml\\\n          interval: 86400\\\n          \\\n        greatfire: # GreatFire 域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/greatfire.txt&quot;\\\n          path: ./ruleset/greatfire.yaml\\\n          interval: 86400\\\n          \\\n        tld-not-cn: # 非中国大陆使用的顶级域名列表\\\n          type: http\\\n          behavior: domain\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt&quot;\\\n          path: ./ruleset/tld-not-cn.yaml\\\n          interval: 86400\\\n          \\\n        telegramcidr: # Telegram 使用的 IP 地址列表\\\n          type: http\\\n          behavior: ipcidr\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt&quot;\\\n          path: ./ruleset/telegramcidr.yaml\\\n          interval: 86400\\\n          \\\n        cncidr: # 中国大陆 IP 地址列表\\\n          type: http\\\n          behavior: ipcidr\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt&quot;\\\n          path: ./ruleset/cncidr.yaml\\\n          interval: 86400\\\n          \\\n        lancidr: # 局域网 IP 及保留 IP 地址列表\\\n          type: http\\\n          behavior: ipcidr\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt&quot;\\\n          path: ./ruleset/lancidr.yaml\\\n          interval: 86400\\\n          \\\n        applications: # 需要直连的常见软件列表\\\n          type: http\\\n          behavior: classical\\\n          url: &quot;https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt&quot;\\\n          path: ./ruleset/applications.yaml\\\n          interval: 86400\\\n</code></pre>\\\n<p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"></p><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;text-align:center;margin-bottom:1em;margin-top:1em;\\\"><img src=\\\":/65a1da7fb7eb44e3b069d5899c0cdaac\\\" type=\\\"image/png\\\" data-filename=\\\"147012458-37fc65da-39cb-46e5-815d-ce6abe030279.png\\\" height=\\\"192\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;max-width:100%;\\\" width=\\\"576\\\"/></div><p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"></p>\\\n</div>\\\n</div></div></div></div></div></div></div></div></div></div>\\\n</div>\\\n</span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":11568}]"
metadata_diff: {"new":{"id":"25a24d2d84c64f319918facb62e61fd6","parent_id":"061de1401cfc4cfaadf6e74e015970e9","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764345841746,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T16:20:19.593Z
created_time: 2025-11-28T16:20:19.593Z
type_: 13