├── .github └── workflows │ └── push.yml ├── CSSRule.txt ├── EasyListnoElementRules.txt ├── README.md ├── abpmerge.txt ├── rule.py └── script └── mian.sh /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | name: Update Rules 2 | on: 3 | schedule: 4 | - cron: '0 20,8 * * *' 5 | push: 6 | workflow_dispatch: 7 | 8 | 9 | jobs: 10 | Pushed: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Setup Python 14 | uses: actions/setup-python@v2 15 | with: 16 | python-version: '3.x' 17 | - uses: actions/checkout@main 18 | - name: Update Rules 19 | run: | 20 | bash ./script/mian.sh 21 | - name: Git push assets to Github 22 | run: | 23 | git init 24 | git config --local user.name "damengzhu" 25 | git config --local user.email "1985980570@qq.com" 26 | git branch -m main 27 | git add . 28 | git commit -m "Updated at $(date)" 29 | #git remote add origin "https://${{ secrets.CODING_TokenUser }}:${{ secrets.CODING_Token }}@e.coding.net/damengzhu/banad/banad.git" 30 | git fetch --unshallow origin 31 | git push -u -f origin main 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ABP Merge Rules 2 | 广告拦截规则合并 3 | 4 | 该规则合并自jiekouAD,AdGuard中文语言规则,10007自用规则,EasyList no Element Rules,EasylistChina,CJX'sAnnoyance,Adblock Warning Removal List 5 | 6 | ## 规则链接: 7 | [https://raw.githubusercontent.com/damengzhu/abpmerge/main/abpmerge.txt](https://raw.githubusercontent.com/damengzhu/abpmerge/main/abpmerge.txt) 8 | ### 镜像: 9 | [https://slink.ltd/https://raw.githubusercontent.com/damengzhu/abpmerge/main/abpmerge.txt](https://slink.ltd/https://raw.githubusercontent.com/damengzhu/abpmerge/main/abpmerge.txt) 10 | -------------------------------------------------------------------------------- /rule.py: -------------------------------------------------------------------------------- 1 | # -*- coding:utf-8 -*- 2 | import os 3 | import sys 4 | gpus = sys.argv[1] 5 | result = [] 6 | ffo = open(gpus,"r+",encoding="utf8") 7 | result=list(set(ffo.readlines())) 8 | result.sort() 9 | ffo.seek(0) 10 | ffo.truncate(0) 11 | ffo.writelines(result) 12 | ffo.close() 13 | -------------------------------------------------------------------------------- /script/mian.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 下载规则 4 | curl -o i-1.txt https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt 5 | curl -o i-2.txt https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_224_Chinese/filter.txt 6 | curl -o i-3.txt https://raw.githubusercontent.com/damengzhu/abpmerge/main/EasyListnoElementRules.txt 7 | curl -o i-4.txt https://raw.githubusercontent.com/lingeringsound/adblock_auto/main/base/%E5%85%B6%E4%BB%96.prop 8 | curl -o i-5.txt https://raw.githubusercontent.com/lingeringsound/adblock_auto/main/base/%E5%8F%8DAdblock.prop 9 | curl -o i-6.txt https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt 10 | curl -o i-7.txt https://easylist-downloads.adblockplus.org/easylistchina.txt 11 | curl -o i-8.txt https://easylist-downloads.adblockplus.org/antiadblockfilters.txt 12 | 13 | # 合并规则并去除重复项 14 | cat i*.txt > i-mergd.txt 15 | cat i-mergd.txt | grep -v '^!' | grep -v '^!' | grep -v '^# ' | grep -v '^# ' | grep -v '^\[' | grep -v '^\【' > i-tmpp.txt 16 | sort -n i-tmpp.txt | uniq > i-tmp.txt 17 | 18 | python rule.py i-tmp.txt 19 | 20 | # 计算规则数 21 | num=`cat i-tmp.txt | wc -l` 22 | 23 | # 添加标题和时间 24 | echo "[Adblock Plus 2.0]" >> i-tpdate.txt 25 | echo "! Title: ABP Merge Rules" >> i-tpdate.txt 26 | echo "! Description: 该规则合并自jiekouAD,AdGuard中文语言规则,10007自用规则,EasyList no Element Rules,EasylistChina,CJX'sAnnoyance,Adblock Warning Removal List" >> i-tpdate.txt 27 | echo "! Homepage: https://github.com/damengzhu/abpmerge" >> i-tpdate.txt 28 | echo "! Version: `TZ=UTC-8 date +"%Y-%m-%d %H:%M:%S"`" >> i-tpdate.txt 29 | echo "! Total count: $num" >> i-tpdate.txt 30 | cat i-tpdate.txt i-tmp.txt > abpmerge.txt 31 | 32 | cat "abpmerge.txt" | grep \ 33 | -e "\(^\|\w\)#@\?#" \ 34 | -e "\(^\|\w\)#@\??#" \ 35 | -e "\(^\|\w\)#@\?\$#" \ 36 | -e "\(^\|\w\)#@\?\$?#" \ 37 | > "CSSRule.txt" 38 | 39 | 40 | # 获取规则文件并将其存储在内存中 41 | EASYLIST=$(wget -q -O - https://easylist-downloads.adblockplus.org/easylist.txt) 42 | 43 | # 移除包含 # 或 generichide 的行 44 | echo "$EASYLIST" | grep -v "#" | grep -v "generichide" > EasyListnoElementRules.txt 45 | 46 | # 将 EasyListnoElementRules.txt 复制到存储库中 47 | cp EasyListnoElementRules.txt /path/to/repository/ 48 | 49 | 50 | # 删除缓存 51 | rm i-*.txt 52 | 53 | #退出程序 54 | exit 55 | 56 | --------------------------------------------------------------------------------