Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚀 CI Updated
Browse files Browse the repository at this point in the history
actions-user committed Feb 1, 2025
0 parents commit f0de044
Showing 33 changed files with 8,445 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[attr]adb linguist-language=AdBlock linguist-detectable

/mod/rules/adblock-rules.txt adb
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'blank_issues_enabled': false
'contact_links':
- 'about': >
Please Read Issue Area Rules before submitting an issue.
For Chinese User: 没看完Issue区版规前少特么瞎几把乱提Issue
'name': 'Issue Area Rules'
'url': 'https://github.com/Cats-Team/AdRules/wiki/Issue-Area-Rules'
- 'about': >
Only For Chinese User: 建议提Issue前先看完这个
'name': '提问的智慧'
'url': 'https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md'
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/content-allowlist-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Content Rules Allowlist Request
description: Report incorrectly blocked website content.
labels: ["content allow"]
assignees:
- zutzo
body:
- type: dropdown
id: adblocker
attributes:
label: Which tool do you use?
description: |
Only the following tools are supported.
multiple: true
options:
- AdGuard
- uBlock Origin
validations:
required: true

- type: dropdown
id: blocklists
attributes:
label: Which List do you use?
multiple: true
options:
- AdRules AdBlock List Lite
- AdRules AdBlock List Normal
- AdRules AdBlock List Plus
validations:
required: true

- type: textarea
id: content
attributes:
label: Which content should be unblocked?
description: |
Please provide the content to be unblocked.
validations:
required: true

- type: textarea
id: reason
attributes:
label: Why should the content be unblocked? Please Upload blocked log and screenshots!
description: |
If necessary, please describe the steps to reproduce. You better add screenshots.
validations:
required: true
66 changes: 66 additions & 0 deletions .github/ISSUE_TEMPLATE/dns-allowlist-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: DNS Rules Allowlist Request
description: Report incorrectly blocked Domains or App
labels: ["dns allow"]
assignees:
- zutzo
- hacamer
body:
- type: dropdown
id: adblocker
attributes:
label: Which tool do you use?
description: |
If the tool is not listed, please select "Other" and enter its name in the comment field below.
multiple: true
options:
- AdGuard
- AdGuard Home
- AdGuard DNS
- Clash Meta
- Quantumult X
- SmartDNS
- Mosdns
- Loon
- Surge
- Other
validations:
required: true
- type: input
id: other
attributes:
label: Other
validations:
required: false

- type: dropdown
id: blocklists
attributes:
label: Which AdRules DNS List Syntax do you use?
multiple: true
options:
- ABP
- mosdns
- Quantumult X
- SmartDNS
- Clash Domainset
- Loon/Surge Ruleset
validations:
required: true

- type: textarea
id: domains
attributes:
label: Which domain(s) should be unblocked?
description: |
Please provide the domains to be unblocked. And add logs screenshots.
validations:
required: true

- type: textarea
id: reason
attributes:
label: Why should the domain(s) be unblocked?
description: |
Please describe the steps to reproduce. You must add screenshots.
validations:
required: true
27 changes: 27 additions & 0 deletions .github/workflows/auto-clean-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Clear commits
on:
workflow_dispatch:
schedule:
- cron: 0 15 */3 * *
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- uses: actions/checkout@v2
with:
ref: script
- name: commit
run: |
git init
git config --local user.name "actions"
git config --local user.email "action@github.com"
git checkout --orphan clearhistory
git branch -D script
git checkout --orphan script
git add .
git commit -m "🚀 CI Updated"
git remote set-url --add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f -u origin script
100 changes: 100 additions & 0 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Update Rules
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- 'script/*'
- 'mod/*'

workflow_dispatch:

repository_dispatch:
type:
- [Manual-Update]

jobs:
update-rules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- uses: actions/setup-node@v2
with:
#node-version: '14'
check-latest: true

# Install hostlist-compiler
- name: Install hostlist-compiler
run: npm i -g @adguard/hostlist-compiler

- name: Update Upstream
continue-on-error: false
run: |
pip install requests
bash ./script/update-upstream.sh
tar -czvf archive.tar.gz ./tmp/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: archive.tar.gz
path: archive.tar.gz

- name: Build Rules
continue-on-error: false
run: |
bash ./script/update-content-rules.sh
bash ./script/update-dns-rules.sh
rm -f archive.tar.gz
- name: Update other rules
run: |
cd rules
rm *.txt
wget https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt
cd ../
- name: Git push assets to Github
run: |
git init
git config --local user.name "actions"
git config --local user.email "action@github.com"
git checkout --orphan main
git rm -rf .github
git rm -rf script
git rm -rf *.md
git add *.{conf,txt,list,html,json,srs,mrs} rules/* mod/*
git commit -m "Update at $(TZ=UTC-8 date +"%Y-%m-%d %H:%M")"
git push -f -u origin main
- name: Git push assets to other repos
continue-on-error: true
run: |
rm -rf .git/
git init
git config --local user.name "hacamer"
git config --local user.email "hcamer145@gmail.com"
git remote add origin "https://cats-team:${{ secrets.GITLAB_TOKEN }}@gitlab.com/cats-team/adrules.git"
git remote set-url --add origin "https://hacamer:${{ secrets.GITEA_TOKEN }}@gitea.com/Cats-Team/AdRules.git"
git remote set-url --add origin "https://hacamer:${{ secrets.BITBUCKET_TOKEN }}@bitbucket.org/hacamer/adrules.git"
git checkout --orphan clearhistory
git add *.{conf,html,txt,json,srs,mrs,list} rules/* mod/*
git commit -am "Update at $(TZ=UTC-8 date +"%Y-%m-%d %H:%M")"
git branch -m main
git push --force --set-upstream origin main
- name: Auto Built
continue-on-error: true
run: |
curl -X POST "${{ secrets.CF_TOKEN }}"
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 0
keep_minimum_runs: 2
22 changes: 22 additions & 0 deletions .github/workflows/close-inactive-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"
workflow_dispatch:
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 3
days-before-issue-close: 7
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 3 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/desize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: desize
on:
workflow_dispatch:

jobs:
clean:
runs-on: ubuntu-latest

steps:
- name: Clone repo
run: git clone --mirror https://cats-team:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} repo_gh

- name: Clean up
run: |
curl -fsSL -o bfg.jar https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar && \
java -jar bfg.jar --strip-blobs-bigger-than 10K -fs 100M repo_gh && \
cd repo_gh && \
git reflog expire --expire=now --all && \
git gc --prune=now --aggressive
- name: Push
run: |
cd repo_gh
git show-ref | cut -d' ' -f2 | grep 'pull' | xargs -r -L1 git update-ref -d
git push origin --force
cd ../
rm -rf repo_gh
#Gitlab
- name: Clone repo
run: git clone --mirror https://cats-team:${{ secrets.GITLAB_TOKEN }}@gitlab.com/cats-team/adrules.git repo_gh

- name: Clean up
run: |
curl -fsSL -o bfg.jar https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar && \
java -jar bfg.jar --strip-blobs-bigger-than 10K -fs 100M repo_gh && \
cd repo_gh && \
git reflog expire --expire=now --all && \
git gc --prune=now --aggressive
- name: Push
run: |
cd repo_gh
git show-ref | cut -d' ' -f2 | grep 'pull' | xargs -r -L1 git update-ref -d
git push origin --force
cd ../
rm -rf repo_gh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
push.sh
.git/
tmp/
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gp.adrules.top
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<center>

<h1>AdRules</h1>

</center>
<br>
<img src="https://img.shields.io/github/stars/Cats-Team/AdRules?style=flat-square&color=yellow">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/cats-team/adrules/main?style=flat-square&color=red">
<img src="https://img.shields.io/github/license/Cats-Team/AdRules?style=flat-square">

</centre>

## Desc.
List for blocking ads in the Chinese region

❔Have any questions? Please go to [Chat](#chat)
📃Want to see the upstream rules? [Source](/Source.md)
<br>

### 📃 Rules List


> [!CAUTION]
> Use the right filter on the right platform or suffer the consequences.
>
- **Content Rules**

| Rules Name | 🚀Github Raw | 🚀Github Pages | 🚀Gitlab Raw | 🚀Cloudflare Pages | 🚀Bitbucket Raw | 🚀Gitea Raw |
|:---: |:---: |:---: |:---: |:---: |:---: |:---: |
| AdRules AdBlock List | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/adblock.txt) | [Link](https://gp.adrules.top/adblock.txt) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/adblock.txt) | [Link](https://adrules.top/adblock.txt) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/adblock.txt) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/adblock.txt)
| AdRules AdBlock List Lite | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/adblock_lite.txt) | [Link](https://gp.adrules.top/adblock_lite.txt) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/adblock_lite.txt) | [Link](https://adrules.top/adblock_lite.txt) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/adblock_lite.txt) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/adblock_lite.txt) ||
| AdRules AdBlock List Plus | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/adblock_plus.txt) | [Link](https://gp.adrules.top/adblock_plus.txt) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/adblock_plus.txt) | [Link](https://adrules.top/adblock_plus.txt) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/adblock_plus.txt) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/adblock_plus.txt)

- **DNS Rules**

Syntax | 🚀Github Raw | 🚀Github Pages | 🚀Gitlab Raw | 🚀Cloudflare Pages | 🚀Bitbucket Raw | 🚀Gitea
:------------------:|:--------------------------------------------------------------------------------------:|:----------------------------------------------------------:|:-----------------------------------------------------------------------------:|:-------------------------------------------------:|:----------------------------------------------------------------------------:|:----------------------------------------------------------------------------:
ABP | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/dns.txt) | [Link](https://gp.adrules.top/dns.txt) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/dns.txt) | [Link](https://adrules.top/dns.txt) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/dns.txt) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/dns.txt) |
SmartDNS | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/smart-dns.conf) | [Link](https://gp.adrules.top/smart-dns.conf) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/smart-dns.conf) | [Link](https://adrules.top/smart-dns.conf) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/smart-dns.conf) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/smart-dns.conf)
MosDNS | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/mosdns_adrules.txt) | [Link](https://gp.adrules.top/mosdns_adrules.txt) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/mosdns_adrules.txt) | [Link](https://adrules.top/mosdns_adrules.txt) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/mosdns_adrules.txt) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/mosdns_adrules.txt)
Clash Domainset | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/adrules_domainset.txt) | [Link](https://gp.adrules.top/adrules_domainset.txt) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/adrules_domainset.txt) | [Link](https://adrules.top/adrules_domainset.txt) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/adrules_domainset.txt) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/adrules_domainset.txt)
Surge/Loon Ruleset | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/adrules.list) | [Link](https://gp.adrules.top/adrules.list) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/adrules.list) | [Link](https://adrules.top/adrules.list) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/adrules.list) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/adrules.list)
Quantumult X | [Link](https://raw.githubusercontent.com/Cats-Team/AdRules/main/qx.conf) | [Link](https://gp.adrules.top/qx.conf) | [Link](https://gitlab.com/cats-team/adrules/-/raw/main/qx.conf) | [Link](https://adrules.top/qx.conf) | [Link](https://bitbucket.org/hacamer/adrules/raw/main/qx.conf) | [Link](https://gitea.com/Cats-Team/AdRules/raw/branch/main/qx.conf)


## License
This project is licensed under the WTFPL License - see the LICENSE file for details.

The WTFPL License is a permissive license that allows you to do whatever you want with the code, without any restrictions or obligations. It is a short and simple license that promotes freedom and flexibility.

## Chat

**✈️https://t.me/AdRules_Offical_Chat**
**https://github.com/Cats-Team/AdRules/issues**

## Sponsor
[Afdian](https://afdian.com/a/Cats-Team)

***Your sponsorship is entirely voluntary and does not grant any special privileges. Thank you for your support!***


[<code><kbd>Back to top</kbd></code>](#)
47 changes: 47 additions & 0 deletions Source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
List Source | Type | Author | License | Comment
:---:|:---:|:---:|:---:|:---:
| | | |
Lite | | | |
https://raw.githubusercontent.com/xinggsf/Adblock-Plus-Rule/master/mv.txt | ABP | xinggsf | No or Unknown |
https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt | ABP | damengzhu | No or Unknown |
https://raw.githubusercontent.com/Noyllopa/NoAppDownload/master/NoAppDownload.txt | ABP | Noyllopa | MIT License |
https://filters.adtidy.org/extension/ublock/filters/224.txt | ABP | AdGuard Team | GPL-3.0 license |
https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt | ABP | cjx82630 | LGPL-3.0 license |
https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt | ABP | reek | CC BY-SA 4.0 license |
https://easylist-downloads.adblockplus.org/antiadblockfilters.txt | ABP | EasyList | EasyList Licence |
https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt | ABP | Adblock Plus Team | GPL-3.0 license |
| | | |
Normal (Based on Lite version) | | | |
https://raw.githubusercontent.com/DandelionSprout/adfilt/master/ClearURLs%20for%20uBo/clear_urls_uboified.txt | ABP | DandelionSprout | DandelionSprout's Licence |
https://filters.adtidy.org/extension/ublock/filters/3_optimized.txt | ABP | AdGuard Team | GPL-3.0 license |
https://easylist-downloads.adblockplus.org/easyprivacy.txt | ABP | EasyList | EasyList Repository Licences |
| | | |
Plus (Based on Normal version) | | | |
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt
https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt | ABP | uBlock Team | GPL-3.0 license |
https://filters.adtidy.org/windows/filters/2.txt
https://filters.adtidy.org/windows/filters/11.txt
https://filters.adtidy.org/windows/filters/3.txt
https://filters.adtidy.org/windows/filters/224.txt
https://filters.adtidy.org/windows/filters/14.txt
https://filters.adtidy.org/windows/filters/4.txt
https://filters.adtidy.org/windows/filters/17.txt | ABP | AdGuard Team | GPL-3.0 license |
| | | |
DNS (Base on Content Filter) | | | |
https://filters.adavoid.org/ultimate-ad-filter.txt
https://filters.adavoid.org/ultimate-privacy-filter.txt | ABP | ultimate Team | GNU GPLv3 / CC BY 3.0 | |
https://easylist-downloads.adblockplus.org/fanboy-annoyance.txt | ABP | Fanboy Team | GNU GPLv3 / CC BY 3.0 | |
https://raw.githubusercontent.com/banbendalao/ADgk/master/ADgk.txt | ABP | Banbendalao | MIT License |
https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt | ABP | hoshsadiq | MIT License |
https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt | ABP | durablenapkin | MIT License |
https://raw.githubusercontent.com/d3ward/toolz/master/src/d3host.adblock | ABP | d3ward | CC BY-NC-SA | |
https://adaway.org/hosts.txt | Hosts | Adaway Team | CC Attribution 3.0 |
https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts | Hosts | jdlingyu | No or Unknown |
https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt | Hosts | crazy-max | MIT License |
https://gitlab.com/quidsup/notrack-blocklists/-/raw/master/malware.hosts | Hosts | QuidsUp | GNU General Public License v3.0 |
https://raw.githubusercontent.com/bigdargon/hostsVN/master/hosts | Hosts | bigdargon | MIT License |
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts | Hosts | StevenBlack | MIT License |
https://urlhaus.abuse.ch/downloads/hostfile/ | Hosts | urlhaus Team | No or Unknown |
https://someonewhocares.org/hosts/zero/hosts | Hosts | someonewhocares | No or Unknown |
https://raw.githubusercontent.com/Spam404/lists/master/main-blacklist.txt | Hosts | Spam404 | No or Unknown
https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt | Clash | Loyalsoldier | GPL-3.0 license | |
277 changes: 277 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
<html>
<head>
<link rel="icon" href="https://avatars.githubusercontent.com/u/88201352" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="List for blocking ads in the Chinese region">
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no"
/>
<title>AdRules</title>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/remarkable/2.0.1/remarkable.min.js"
integrity="sha512-skYYbQHAuOTpeJTthhUH3flZohep8blA+qjZOY0VqmfXMDiYcWxu29F5UbxU4LxaIpGkRBk+3Qf8qaXfd9jngg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<style>
select ~ article[id] {
display: block;
opacity: 0;
transition: opacity 0.45s ease-in-out;
}
select ~ article[id].show {
opacity: 1;
}
select ~ article[id].hide {
display: none;
}
</style>
<meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0">
<style>
.container {
width: 80%;
margin: 10% auto 0;
background-color: rgba(255,255,255,0.7);
padding: 2% 5%;
border-radius: 10px
}

ul {
padding-left: 20px;
}

ul li {
line-height: 2.3
}

a {
color: #20a53a
}
select {
font-size: 16px;
} .styled-select {
border: 1px solid #ccc;
border-radius: 4px;
padding: 6px 10px;
font-size: 16px;
color: #333;
}

.copy-button {
margin-top: 10px;
cursor: pointer;
padding: 10px;
border-radius: 5px;
background-color: #4CAF50; /* Green */
border: none;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
.add-button {
margin-top: 10px;
cursor: pointer;
padding: 10px;
border-radius: 5px;
background-color: #4CAF50; /* Green */
border: none;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
</style>
</head>
<body>
<div class="container" align="center">
<header>
<article><pre>
## **AdRules**

### *List for blocking ads in the Chinese region*
</pre></article>
<img src="https://img.shields.io/github/stars/Cats-Team/AdRules?style=flat-square&color=yellow">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/cats-team/adrules/main?style=flat-square&color=red">
<img src="https://img.shields.io/github/license/Cats-Team/AdRules?style=flat-square"><br>
<br>
</header>
<main>
<select class="styled-select">
<option value="empty" hidden selected>Choose Your Tool:</option>
<optgroup label="Browser & App">
<option value="adge">Browser Extension</option>
<option value="adgai">AdGuard for Android/iOS</option>
<option value="adgwm">AdGuard for Windows/Mac</option>
</optgroup>
<optgroup label="DNS & Proxy">
<option value="adgh">AdGuard Home</option>
<option value="sd">SmartDNS</option>
<option value="qx">Quantumult X</option>
<option value="cla">Clash</option>
<option value="mosdns">mosdns</option>
<option value="loon">Loon</option>
<option value="surge">Surge</option>
<option value="singbox">Singbox</option>
</optgroup>
</select>
<article id="adgai" class="hide"><pre>
### AdGuard for Android / iOS

<a href="./adblock.txt">AdRules AdBlock List</a><br>
<button class="copy-button">Copy Link</button>
<button class="add-button">Add Your Tool</button>
</pre></article>
<article id="adgwm" class="hide"><pre>
### AdGuard for Windows / Mac

<a href="./adblock_plus.txt">AdRules AdBlock List Plus </a><br>
<button class="copy-button">Copy Link</button>
<button class="add-button">Add Your Tool</button>
</pre></article>
<article id="adge" class="hide"><pre>
### AdGuard Browser extension / uBlock Origin

<a href="./adblock.txt">AdRules AdBlock List</a><br>
<button class="copy-button">Copy Link</button>
<button class="add-button">Add Your Tool</button>
</pre></article>
<article id="adgh" class="hide"><pre>
### AdGuard Home

<a href="./dns.txt">AdRules DNS List </a>
<button class="copy-button">Copy Link</button>
</pre></article>
<article id="sd" class="hide"><pre>
### SmartDNS

<a href="./smart-dns.conf">AdRules SmartDNS List </a>
<button class="copy-button">Copy Link</button>
</pre></article>
<article id="qx" class="hide"><pre>
### Quantumult X

<a href="./qx.conf">AdRules Quantumult X List </a>
<button class="copy-button">Copy Link</button>
</pre></article>
<article id="cla" class="hide"><pre>
### Clash / Mihomo

<a href="./adrules_domainset.txt">AdRules Clash Domainset List </a>
<button class="copy-button">Copy Link</button>
</pre></article>
<article id="mosdns" class="hide"><pre>
### mosdns

<a href="./mosdns_adrules.txt">AdRules MosDNS List </a>
<button class="copy-button">Copy Link</button>
</pre></article>
<article id="loon" class="hide"><pre>
### Loon

<a href="./adrules.list">AdRules Ruleset List </a>
<button class="copy-button">Copy Link</button>
</pre></article>
<article id="surge" class="hide"><pre>
### Surge

<a href="./adrules-surge.conf">AdRules Surge List </a>
<button class="copy-button">Copy Link</button>
</pre></article>
<article id="singbox" class="hide"><pre>
### Singbox

<a href="./adrules-singbox.srs">AdRules Singbox List </a>
<button class="copy-button">Copy Link</button>
</pre></article>

</main>
<footer>
<article><pre>

( ̄︶ ̄)↗ 

❔Have any questions? Please go to [Chat](https://github.com/Cats-Team/AdRules#chat)
📃Want to see the upstream rules? [Source](https://github.com/Cats-Team/AdRules/blob/script/Source.md)
🌟Get more or give a star? [GitHub Homepage](https://github.com/Cats-Team/AdRules)</pre></article>

</footer>
<script>
const md = new remarkable.Remarkable({
html: true,
});
document.querySelectorAll("article").forEach((art) => {
art.innerHTML = md.render(art.querySelector("pre").innerHTML);
});
document.querySelector("select").addEventListener("change", (e) => {
document.querySelectorAll("select ~ article[id].show").forEach((art) => {
art.classList.remove("show");
});
setTimeout(() => {
if (e.target.value !== "empty") {
document.querySelectorAll("select ~ article[id]").forEach((art) => {
if (art.id===e.target.value) {
art.classList.remove("hide");
} else {
art.classList.add("hide");
}
});
} else {
document.querySelectorAll("select ~ article[id]").forEach((art) => {
art.classList.add("hide");
});
}
}, 500);
setTimeout(() => {
document.querySelectorAll("select ~ article[id]").forEach((art) => {
if (art.id===e.target.value) {
art.classList.add("show")
}
});
}, 900);
});
</script>
<script>
const copyButtons = document.querySelectorAll(".copy-button");
copyButtons.forEach(button => {
button.addEventListener('click', () => {
let href = button.parentElement.querySelector('a').getAttribute('href');
href = href.replace('./', '/');
navigator.clipboard.writeText(window.location.origin + href).then(() => {
button.innerText = "Copied";
}).catch(err => {
console.error('Could not copy text: ', err);
});
});
});

const addButtons = document.querySelectorAll(".add-button");
addButtons.forEach((button) => {
button.addEventListener("click", () => {
let href = button.parentElement
.querySelector("a")
.getAttribute("href");
href = href.replace("./", "/");
const fullUrl =
"abp:subscribe?location=" +
encodeURIComponent(window.location.origin + href);

const hideA = document.createElement("a");
hideA.style.cssText = "position:absolute;top:-100%";
hideA.href = fullUrl;
document.body.appendChild(hideA);
hideA.click();
hideA.remove();
});
});

document.querySelector("select").value = "empty";
</script>

</body>
<br>
</html>
9 changes: 9 additions & 0 deletions mod/rules/adblock-need-remove.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
||imasdk.googleapis.com^

||bing.com/fd/ls/GLinkPing.aspx?

||bing.com^*/glinkping.aspx$ping,xmlhttprequest

||bing.com/fd/ls/

||gia.jd.com^
128 changes: 128 additions & 0 deletions mod/rules/adblock-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
! ------加强屏蔽Start------ !

!酷安"提到的好物"
||coolapk.com/v6/page/dataList?$replace=/extra_entities//
||coolapk.com/v6/feed/detail?$replace=/extra_entities//
||coolapk.com/v6/main/indexV?$replace=/extra_entities//
||coolapk.com/v6/feed/detail?$replace=/extra_title//
||coolapk.com/v6/feed/detail?$replace=/include_goods//

!去除"什么值得买"
||coolapk.com/v6/main/indexV8?$replace=/\{"entityType":"card"\,"entityTemplate":"listCard".*?\}\,\{"id/{"id/
!去除热搜
||coolapk.com/v6/main/init?$replace=/\{"data":\[\{"entityType":"card"\,"entityTemplate":"textCard"\,"title":"\\u70ed\\u95e8\\u641c\\u7d22".*?\}\,\{"entityType":"card"\,"entityTemplate":"configCard"/\{"data":[\{"entityType":"card"\,"entityTemplate":"configCard"/
||coolapk.com/v6/search?type=hotSearch$replace=/\{"data":\[.*\]/{"data":[]/
!去除随机应用推荐
||coolapk.com/v6/main/indexV8?$replace=/\,\{.*?"entityType": "card"\,"entityTemplate":"apkImageCard".*?\}\,\{"id"/,{"id"/
!去除评论区下某广告
||coolapk.com/v6/feed/detail?$replace=/detailSponsorCard//

! 信息流及评论区广告
||ctobsnssdk.com^
||pangolin.snssdk.com^
||pangolin-sdk-toutiao.com^
||pangolin-sdk-toutiao-b.com^
||pglstatp-toutiao.com^
||umeng.com^
||tnc*.zijieapi.com^$app
! 帖子详情好物推荐
||api2.coolapk.com/v6/feed/detail$replace=/"_ids":\[.*?]\,"":\[.*?]\,/ /
! 帖子详情赞助内容
||api2.coolapk.com/v6/feed/detail$replace=/\,"":{.*}/}}/
! 发现页去除酷品
||api2.coolapk.com/v6/main/init$replace=/{"id":1170.*?}\,/ /
! 应用游戏页去除推广视频
||api2.coolapk.com/v6/page/dataList$replace=/{"entityType":"card"\,"entityTemplate":"apkImageCard".*?\\u0022}"}\,/ /
! 去除首页还有什么值得买推广
||api2.coolapk.com/v6/main/indexV8$replace=/{"entityType":"card"\,"entityTemplate":"listCard".*?}"}\,/ /

!酷我
||g.koowo.com^$app=cn.kuwo.player
||fvedio.kuwo.cn^$app=cn.kuwo.player
||searchrecterm.kuwo.cn^$app=cn.kuwo.player
||media.cdn.kuwo.cn*tuijian*.json$app=cn.kuwo.player

!全民k歌
||y.qq.com/music/common/upload/t_kg_activity_show^
||y.gtimg.cn/music/common//upload/kg_ad^
||us.l.qq.com/exapp^
||httpdns.kg.qq.com^



!抖音屏蔽大部分广告
!番茄小说广告全屏蔽
||ads*-normal*.zijieapi.com^
||p*-ad-sign.byteimg.com^

! 大海影视
||uty.micocc.com^
||lanm.huliyinzi.com^
||ns.adobe.com^
||swimg2.tsderen.cn^
||st.huliyinzi.com/ads_app_pic/^

! 快手AD
||yoda.kwd.inkuai.com^
||gdfp.gifshow.com^
||volceapplog.com^

!小睡眠
||api.psy-1.com/cosleep/newborn/vips/picks^
||api.psy-1.com/cosleep/newborn/ad^
||res.psy-1.com/music/recommend^$app=com.psyone.brainmusic

!小米遥控器
||home.mi.com/cgi-op/api/v1/recommendation/banner^

!由asky88提供的不太记得是什么作用的规则

||xj-landing.gdtimg.com^
||*/vhot2.qqvideo.tc.qq.com^
||soup.v.qq.com^

! -------加强屏蔽End------- !

! -------白名单Start------- !
! AdGuard
@@||local.adguard.org^

! Edge新闻
@@||www.msn.cn/spartan/mmx^

! 银联
@@||yyfweb.postar.cn^

! Bilibili
bilibili.com#@#.btn-ctnr

! Phone Youku
@@||vali.cp*.ott.cibntv.net^$domain=m.youku.com,third-party

! 皮皮虾评论区误杀
@@||i.snssdk.com/bds^$app=com.sup.android.superb

!mydrivers.com
mydrivers.com#@#.baidu, a[href^=http][target=_blank]

! Bilibiili API
@@||api.bilibili.com/*^$removeparam

!https://es6.ruanyifeng.com/#docs/module无法加载
ruanyifeng.com#@#a[href*=".apeclass.com"]

! b站 投币 收藏 #66
bilibili.com#@#.bili-dialog-m

! 百度云转存 #59
@@||pan.baidu.com/$removeparam,domain=pan.baidu.com

! 验证码
cjcx.neea.edu.cn#@#[style="visibility: visible; display: block;"]

! 魅族主题 #90
@@||ccm*.res.meizu.com/fileserver/operation/ad/img/*.png

#189
@@||safe.zhanhuo.com^$domain=safe.zhanhuo.com
! --------白名单End-------- !
1,746 changes: 1,746 additions & 0 deletions mod/rules/dns-rules.txt

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions mod/rules/first-dns-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/^admarvel\./
/^admaster\./
/^adsage\./
/^adsensor\./
/^adservice\./
/^adsmogo\./
/^adsrvmedia\./
/^adsserving\./
/^adsystem\./
/^adwords\./
/^applovin\./
/^appsflyer\./
/^domob\./
/^duomeng\./
/^dwtrack\./
/^guanggao\./
/^omgmta\./
/^omgmtaw\./
/^omniture\./
/^openx\./
/^partnerad\./
/^pingfore\./
/^socdm\./
/^supersonicads\./
/^wlmonitor\./
/^zjtoolbar\./
/^.+stat\.kugou\.com/
7 changes: 7 additions & 0 deletions mod/title/adblock-title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Adblock Plus 2.0]
! Title: AdRules AdBlock List
! Homepage: https://github.com/Cats-Team/AdRules
! Powerd by Cats-Team
! Expires: 1 day (update frequency)
! Description: Merge from EasyList,EasyListChina etc. and Add Some Rules.
!
7 changes: 7 additions & 0 deletions mod/title/adblock_lite-title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Adblock Plus 2.0]
! Title: AdRules AdBlock List Lite
! Homepage: https://github.com/Cats-Team/AdRules
! Powerd by Cats-Team
! Expires: 1 day (update frequency)
! Description: AdRules AdBlock List's Lite Version, And Remove Some Filters
!
7 changes: 7 additions & 0 deletions mod/title/adblock_plus-title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Adblock Plus 2.0]
! Title: AdRules AdBlock List Plus
! Homepage: https://github.com/Cats-Team/AdRules
! Powerd by Cats-Team
! Expires: 1 day (update frequency)
! Description: AdRules AdBlock List's Plus Verison, And Add Some Filters
!
6 changes: 6 additions & 0 deletions mod/title/dns-title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Adblock Plus 2.0]
! Title: AdRules DNS List
! Homepage: https://github.com/Cats-Team/AdRules
! Powerd by Cats-Team
! Expires: 1 (update frequency)
! Description: The DNS Filters
5,096 changes: 5,096 additions & 0 deletions rules/jiekouAD.txt

Large diffs are not rendered by default.

278 changes: 278 additions & 0 deletions script/allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
#!-白名单-!#

#! Apple 白名单 Start !#
#苹果商店
xp.apple.com
#苹果音乐
securemetrics.apple.com
#苹果小游戏
stats.gc.apple.com
#苹果图标
is[0-9]\-ssl.mzstatic.com
#! Apple 白名单 End !#

#! 网易 白名单 Start !#
#光遇
fp-upload.dun.163.com
#网易严选商家后台 #140
dl.reg.163.com
#网易云音乐-直播
api.iplay.163.com
#! 网易 白名单 End !#

#! 百度 白名单 Start !#
#手机web百度跳转
boxer.baidu.com
#百度盘p2p
bcsp2p.baidu.com
#百度地图 #201
newvector.map.baidu.com
#额外
sv.map.baidu.com
#百度贴吧签到
als.baidu.com
#贴吧网页版表情 #146
gsp0.baidu.com
#成都 地震预警
newloc.map.n.shifen.com
#爱奇艺VIP活动
act.vip.iqiyi.com
#! 百度 白名单 End !#

#! Microsoft 白名单 Start !#
#win天气 #202
api.msn.com
#skype #199 #188
events.data.microsoft.com
mobile.pipe.aria.microsoft.com
browser.pipe.aria.microsoft.com
c1.skype.com
c.bing.com
#edge and windows
ntp.msn.cn
ntp.msn.com
assets.msn.cn
#Microsoft游戏纸牌
solitaireevents.microsoftcasualgames.com
#! Microsoft 白名单 End !#

#! 小米 白名单 Start !#
# 小米 隐私条款撤回 #195
data.sec.miui.com
#MIUI校正流量
api.sec.miui.com
# 小米社区
api.vip.miui.com
#mipush
chat.xiaomi.net
register.xmpush.xiaomi.com
cn.app.chat.xiaomi.net
resolver.msg.xiaomi.net
#小米天气
wtradv.market.xiaomi.com
#应用商店
f8.market.xiaomi.com
#! 小米 白名单 End !#

#! Google 白名单 Start !#
# 186 麦当劳
firebaseremoteconfig.googleapis.com
#google
safebrowsing.googleapis.com
#mytvsuper
imasdk.googleapis.com
#fcm push
firebaseinstallations.googleapis.com
#! Google 白名单 End !#

#! 三大运营商 白名单 Start !#
#电信一键登录
id6.me
#移动一键登录
da.mmarket.com
#免流
cmpassport.com
#中国联通app充值以及相关页面误杀 #153
fraudmetrix.cn
#移动云盘AI
ad.mcloud.139.com
#! 三大运营商 白名单 End !#

#! 阿里 白名单 Start !#
#阿里
amdc.m.taobao.com
#淘宝千牛商家 #151
acs.m.taobao.com
#淘宝
click.mz.simba.taobao.com
#淘宝阿里旺旺买家版聊天对话窗
amos.alicdn.com
#UC浏览器
wgo.mmstat.com
gm.mmstat.com
#优酷
mmstat.com
#饿了么会员开通
cashier.ele.me
#饿了么再来一单
buy.ele.me
#饿了么搜索
h-adashx.ut.ele.me
# 夸克登录
api.open.uc.cn
# uc
p.bokecc.com
#! 阿里 白名单 End !#

#! 直播与短视频平台 白名单 Start !#
#斗鱼礼物
gift.douyucdn.cn
#抖音图片
p3-ad-sign.byteimg.com
#虎牙直播 #177
va.huya.com
#火山视频图片
img2.autoimg.cn
#今日头条
ib.snssdk.com
ic.snssdk.com
is.snssdk.com
#抖音验证码
mcs.snssdk.com
vcs.snssdk.com
verify.snssdk.com
#虎牙
livewebbs2.msstatic.com
liveweb\*\.msstatic\.com
#哔哩哔哩橱窗功能 #122
miniapp.bilibili.com
#bili评论
grpc.biliapi.net
#bili直播
live-trace.bilibili.com
#! 直播与短视频平台 白名单 End !#

#! 未分类大厂 白名单 Start !#
#pronhub cdn
evtubescms.phncdn.com
#雅虎 js
consent.cmp.oath.com
# 迅雷书签
api-shoulei-ssl.xunlei.com
#cdn
cloudfront.net
#京东礼品卡
gia.jd.com
#微信验证
szlong.weixin.qq.com
# 搜狗同步
get.sogou.com
input.shouji.sogou.com
ping.pinyin.sogou.com
info.pinyin.sogou.com
#360智慧生活
sobot.com
#360DNS
qhres2.com
# adtidy
.*\.adtidy\.org$
# 通配误杀脚本之家
\*\.jbzj\.com
#adg邮件跳转
email-link.adtidy.org
#奇怪的cname误杀
tanx.com
#招商银行掌上生活
metric.ccc.cmbchina.com
#OPPO
client-uc.heytapmobi.com
#OPPO应用配置
appconf.heytapdownload.com
#QQ打卡
tianshu.gtimg.cn
#Intel驱动
static.cloud.coveo.com
#企业微信 #208
tdid.m.qq.com
#! 未分类大厂 白名单 End !#

#! 乱七八糟的域名 白名单 Start !#

#jameswoof 游戏
app.jameswoof.com

#OpenCat
lc-cn-n1-shared.com

#bmcx.com cname
7x24s.com

# 待补充
similarweb.com

#纵横小说
static.zongheng.com

#乘车码 #178
ecard.shenzhentong.com

#东方财富 图片
dfcfw.com

#umiwi.com
imgcdn.umiwi.com

#误杀CNAME angtv.cc
gotoip55.com

# 网盘 #168
pan.tenire.com

#今日基督教 #167
christianitytoday.activehosted.com

#sm图床
loli.net

#电影
free-adsmind.ugdtimg.com

#mytvsuper #144
jwpcdn.com

#游戏换购码
statistics.pandadastudio.com

#云课堂
www.mosoteach.cn
api.mosoteach.cn

# 图床
z4a.net

# 开心消消乐
animalmobile.happyelements.cn

# 汽车之家加载页
activity.app.autohome.com.cn

#不知道的域名 #49
epochtimes.com
epochtimes.org

# 购物党
browser.gwdang.com

#206
logrocket.com

#app mirror #209
html-load.com
content-loader.com

#215
instant.page
#! 乱七八糟的域名 白名单 End !#


#---END---#
14 changes: 14 additions & 0 deletions script/clean-readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
num_adl=`sed -n 's/^! Total count: //p' adblock_lite.txt`
num_adb=`sed -n 's/^! Total count: //p' adblock.txt`
num_adp=`sed -n 's/^! Total count: //p' adblock_plus.txt`
num_dns=`sed -n 's/^! Total count: //p' dns.txt`
#num_domains=`sed -n 's/^! Total count: //p' ad-domains.txt`

time=$(TZ=UTC-8 date +'%Y-%m-%d %H:%M:%S')
sed -i "s/^Update Time:.*/Update Time: $time /g" README.md
sed -i 's/^AdRules AdBlock List :.*/AdRules AdBlock List : '$num_adb' /g' README.md
sed -i 's/^AdRules AdBlock List Plus :.*/AdRules AdBlock List Plus : '$num_adp' /g' README.md
sed -i 's/^AdRules AdBlock List Lite :.*/AdRules AdBlock List Lite : '$num_adl' /g' README.md
sed -i 's/^AdRules DNS List .*/AdRules DNS List : '$num_dns' /g' README.md
exit
20 changes: 20 additions & 0 deletions script/dns-rules-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "The DNS List",
"description": "Blocks ads, analytics, trackers, crypto-jacking & other such threats/nuisances. Addon lists are available to extend this list.",
"sources": [
{
"name": "DNS List",
"source": "dns.txt",
"type": "adblock",
"transformations": ["RemoveComments", "Compress","RemoveModifiers","Deduplicate","Validate"]
},
{
"name": "DNS Filters",
"source": "https://raw.githubusercontent.com/Cats-Team/dns-filter/main/abp.txt",
"type": "adblock",
"transformations": ["RemoveComments", "Compress"]
}
],
"exclusions_sources": ["https://raw.githubusercontent.com/Cats-Team/deadhosts/main/dead.txt","./script/allowlist.txt"],
"transformations": ["Deduplicate", "Compress","TrimLines","Deduplicate","Validate","RemoveEmptyLines"]
}
17 changes: 17 additions & 0 deletions script/dns-script/singbox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import json
from datetime import datetime

with open('domain.txt', 'r') as file:
domains = [line.strip() for line in file]

rules = {
"version": "1",
"rules": [
{
"domain_suffix": domains
}
]
}

with open('adrules-singbox.json', 'w') as file:
json.dump(rules, file, indent=4)
47 changes: 47 additions & 0 deletions script/dns-script/surge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import re
import requests
from datetime import datetime

url = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/BanAD.list"
response = requests.get(url)
banad_list = response.text.splitlines()

with open("adrules-surge.conf", "w") as surge_file:
surge_file.write(f"# Generated at {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
domain_wildcard_count = 0
domain_keyword_count = 0
domain_suffix_count = 0
for line in banad_list:
if line.startswith("DOMAIN-KEYWORD"):
domain_keyword_count += 1

pattern = r"(?<=\|\|).+(?=\^)"
with open('dns.txt', 'r') as file:
lines = file.readlines()

domains = []
for line in lines:
line = line.strip()
match = re.search(pattern, line)
if match:
domain = match.group(0)
if '*' in domain:
domains.append(f"DOMAIN-WILDCARD,{domain}")
domain_wildcard_count += 1
else:
domains.append(f"DOMAIN-SUFFIX,{domain}")
domain_suffix_count += 1

domains.sort()

# Write sorted domains to adrules-surge.conf
with open('adrules-surge.conf', 'a') as output_file:
output_file.write(f"# DOMAIN-WILDCARD: {domain_wildcard_count}\n")
output_file.write(f"# DOMAIN-KEYWORD: {domain_keyword_count}\n")
output_file.write(f"# DOMAIN-SUFFIX: {domain_suffix_count}\n")
for line in banad_list:
if line.startswith("DOMAIN-KEYWORD"):
output_file.write(line + "\n")

for domain in domains:
output_file.write(domain + "\n")
34 changes: 34 additions & 0 deletions script/remove.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import re

# 从文件中读取黑名单
with open('./dns.txt', 'r', encoding='utf-8') as f:
blacklist = [line.strip() for line in f.readlines() if line.strip() and not line.startswith("#")]

# 从文件中读取白名单
with open('./script/allowlist.txt', 'r', encoding='utf-8') as f:
whitelist = [line.strip() for line in f.readlines() if line.strip() and not line.startswith("#")]

# 新的黑名单
new_blacklist = blacklist

# 遍历白名单
for white_item in whitelist:
# 判断白名单项是否为正则表达式
try:
re.compile(white_item)
is_regex = True
except re.error:
is_regex = False

# 根据白名单项是正则表达式还是子字符串进行处理
if is_regex:
# 如果是正则表达式,添加前缀和后缀
white_item = r'^\|\|' + white_item + r'\^$'
new_blacklist = [domain for domain in new_blacklist if not re.match(white_item, domain)]
else:
new_blacklist = [domain for domain in new_blacklist if domain != white_item]

# 将新的黑名单写入到文件中
with open('./dns.txt', 'w', encoding='utf-8') as f:
for domain in new_blacklist:
f.write(domain + '\n')
14 changes: 14 additions & 0 deletions script/rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import sys

gpus = sys.argv[1]
result = []

# 读取文件内容,注意指定newline参数为LF
with open(gpus, "r+", encoding="utf8", newline='') as ffo:
result = list(set(ffo.readlines()))
result.sort()

# 重新写入文件,注意指定newline参数为LF
with open(gpus, "w", encoding="utf8", newline='') as ffo:
ffo.writelines(result)
61 changes: 61 additions & 0 deletions script/update-content-rules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/sh
LC_ALL='C'

cd tmp

# Start Merge and Duplicate Removal

echo Start Merge

rules=(
jiekouAD.txt
224.txt
NoAppDownload.txt
cjx-annoyance.txt
anti-adblock-killer-filters.txt
antiadblockfilters.txt
abp-filters-anti-cv.txt
)

#Lite
echo " " > pre-lite.txt

for file in "${rules[@]}"
do
cat "./content/$file" >> pre-lite.txt
done

echo "! Version: $(TZ=UTC-8 date +'%Y-%m-%d %H:%M:%S')(GMT+8) " > tpdate.txt
cat ../mod/title/adblock_lite-title.txt .././mod/rules/adblock-rules.txt pre-lite.txt \
| grep -Ev "^((\!)|(\[)).*" | sort -n | uniq > adblock_lite_pre.txt
grep -vxFf ../mod/rules/adblock-need-remove.txt ./adblock_lite_pre.txt > adblock_lite.txt

python ../script/rule.py adblock_lite.txt
echo "! Total count: $(wc -l < adblock_lite.txt)" > total.txt
cat ../mod/title/adblock_lite-title.txt tpdate.txt total.txt adblock_lite.txt > tmp.txt && mv tmp.txt adblock_lite.txt


#Normal
cat ../mod/title/adblock_lite-title.txt adblock_lite.txt ./content/{3.txt,clear_urls_uboified.txt,easyprivacy.txt}\
| grep -Ev "^((\!)|(\[)).*" | sort -n | uniq > adblock_pre.txt
grep -vxFf ../mod/rules/adblock-need-remove.txt ./adblock_pre.txt > adblock.txt

python ../script/rule.py adblock.txt
echo "! Total count: $(wc -l < adblock.txt)" > total.txt
cat ../mod/title/adblock-title.txt tpdate.txt total.txt adblock.txt > tmp.txt && mv tmp.txt adblock.txt


#Plus
cat adblock.txt ./content/*.txt \
| grep -Ev "^((\!)|(\[)).*" | sort -n | uniq > adblock_plus_pre.txt
grep -vxFf ../mod/rules/adblock-need-remove.txt ./adblock_plus_pre.txt > adblock_plus.txt


python ../script/rule.py adblock_plus.txt
echo "! Total count: $(wc -l < adblock_plus.txt)" > total.txt
cat ../mod/title/adblock_plus-title.txt tpdate.txt total.txt adblock_plus.txt > tmp.txt && mv tmp.txt adblock_plus.txt

rm adblock*pre.txt
mv adblock*.txt ../

exit
55 changes: 55 additions & 0 deletions script/update-dns-rules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
LC_ALL='C'

update_time="$(TZ=UTC-8 date +'%Y-%m-%d %H:%M:%S')(GMT+8)"

cp ./mod/rules/*rule* ./tmp/dns/

cat ./tmp/dns/* | grep -Ev '[A-Z]' |grep -vE '@|:|\?|\$|\#|\!|/' | sort | uniq >dns.txt

hostlist-compiler -c ./script/dns-rules-config.json -o dns-output.txt

cat dns-output.txt |grep -P "^\|\|[a-z0-9\.\-\*]+\^$"> dns.txt

python ./script/remove.py

cat ./mod/rules/first-dns-rules.txt >> dns.txt
python ./script/rule.py dns.txt
echo -e "! Total count: $(wc -l < dns.txt) \n! Update: $update_time" > total.txt
cat ./mod/title/dns-title.txt total.txt dns.txt | sed '/^$/d' > tmp.txt && mv tmp.txt dns.txt


echo "# Title:AdRules Quantumult X List " > qx.conf
echo "# Title:AdRules SmartDNS List " > smart-dns.conf
echo "# Title:AdRules List " > adrules.list
echo "# Update: $update_time" >> qx.conf
echo "# Update: $update_time" >> smart-dns.conf
echo "# Update: $update_time" >> adrules_domainset.txt
echo "# Update: $update_time" >> adrules.list

cat dns.txt |grep -vE '(@|\*)' |grep -Po "(?<=\|\|).+(?=\^)" | grep -v "\*" > ./domain.txt
cat domain.txt |sed 's/^/host-suffix,/g'|sed 's/$/,reject/g' >> ./qx.conf
cat domain.txt |sed "s/^/address \//g"|sed "s/$/\/#/g" >> ./smart-dns.conf
cat domain.txt |sed "s/^/domain:/g" > ./mosdns_adrules.txt
cat domain.txt |sed "s/^/\+\./g" >> ./adrules_domainset.txt
cat domain.txt |sed "s/^/DOMAIN-SUFFIX,/g" >> ./adrules.list

python ./script/dns-script/singbox.py
python ./script/dns-script/surge.py

wget -O ssc https://github.com/PuerNya/sing-srs-converter/releases/download/v2.0.1/sing-srs-converter-v2.0.1-linux-x86_64_v3
chmod +x ssc
./ssc adrules.list -m
mv adrules.list.srs adrules-singbox.srs

wget https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/version.txt
version=$(cat version.txt)
wget "https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/mihomo-linux-amd64-$version.gz"
gzip -d "mihomo-linux-amd64-$version.gz"
chmod +x "mihomo-linux-amd64-$version"
./"mihomo-linux-amd64-$version" convert-ruleset domain text adrules_domainset.txt adrules-mihomo.mrs

rm ssc mihomo-linux-amd64 *.gz version.txt
rm dns-output.txt total.txt domain.txt

exit
143 changes: 143 additions & 0 deletions script/update-upstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#!/bin/sh
LC_ALL='C'

download_file() {
url=$1
directory=$2
filename=$(basename $url)
filepath="$directory/$filename"
retries=3
while [ $retries -gt 0 ]; do
if curl -sS -o $filepath $url; then
echo "Downloaded $url successfully"
# 在文件的第一行插入 ! url: $url
sed -i "1i\\! url: $url" $filepath
return
else
echo "Failed to download $url, retrying..."
retries=$((retries-1))
fi
done
echo "Failed to download $url after 3 retries, exiting script."
exit 1
}

wait
# Create temporary folder
mkdir -p ./tmp/
cd tmp

# Start Download Filter File
echo 'Start Downloading...'

content=(
#damengzhu
"https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt"
#Noyllopa NoAppDownload
"https://raw.githubusercontent.com/Noyllopa/NoAppDownload/master/NoAppDownload.txt"
#china
#"https://filters.adtidy.org/extension/ublock/filters/224.txt"
#cjx
"https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt"
#anti-anti-ad
"https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt"
"https://easylist-downloads.adblockplus.org/antiadblockfilters.txt"
"https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt"
#--normal
#Clean Url
"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/ClearURLs%20for%20uBo/clear_urls_uboified.txt"
#english opt
"https://filters.adtidy.org/extension/ublock/filters/2_optimized.txt"
#EasyListPrvacy
"https://easylist-downloads.adblockplus.org/easyprivacy.txt"
#--plus
#ubo annoyance
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt"
#ubo privacy
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt"
#adg base
"https://filters.adtidy.org/windows/filters/2.txt"
#adg privacy
"https://filters.adtidy.org/windows/filters/3.txt"
#adg cn
"https://filters.adtidy.org/windows/filters/224.txt"
#adg annoyance
"https://filters.adtidy.org/windows/filters/14.txt"
)

dns=(
#Ultimate Ad Filter
"https://filters.adavoid.org/ultimate-ad-filter.txt"
#Ultimate Privacy Filter
"https://filters.adavoid.org/ultimate-privacy-filter.txt"
#Social
"https://filters.adtidy.org/windows/filters/4.txt"
#Annoying
"https://filters.adtidy.org/windows/filters/14.txt"
"https://easylist-downloads.adblockplus.org/fanboy-annoyance.txt"
#Mobile Ads
"https://filters.adtidy.org/windows/filters/11.txt"
#Chinese and English
"https://filters.adtidy.org/windows/filters/2.txt"
"https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt"
"https://filters.adtidy.org/windows/filters/224.txt"
#Fuck Tracking
"https://easylist-downloads.adblockplus.org/easyprivacy.txt"
"https://filters.adtidy.org/windows/filters/3.txt"
#anti-coin
"https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt"
#scam
"https://raw.githubusercontent.com/durablenapkin/scamblocklist/master/adguard.txt"
#damengzhu
"https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt"
#xinggsf
"https://raw.githubusercontent.com/xinggsf/Adblock-Plus-Rule/master/mv.txt"
#uBO
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt"
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/badware.txt"
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt"
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/privacy.txt"
#cjx
"https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt"
#anti-anti-ad
"https://raw.githubusercontent.com/reek/anti-adblock-killer/master/anti-adblock-killer-filters.txt"
"https://easylist-downloads.adblockplus.org/antiadblockfilters.txt"
"https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt"
#HostsVN
"https://raw.githubusercontent.com/bigdargon/hostsVN/master/filters/adservers-all.txt"
#hosts
#anti-windows-spy
"https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt"
#Notarck-Malware
"https://gitlab.com/quidsup/notrack-blocklists/-/raw/master/malware.hosts"
#hostsVN
"https://raw.githubusercontent.com/bigdargon/hostsVN/master/filters/adservers-all.txt"
#StevenBlack
"https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts"
#SomeoneNewWhoCares
"https://someonewhocares.org/hosts/zero/hosts"
#Brave
"https://raw.githubusercontent.com/brave/adblock-lists/master/brave-lists/brave-firstparty.txt"
#Me
"https://raw.githubusercontent.com/Cats-Team/dns-filter/main/abp.txt"
)

mkdir -p content
mkdir -p dns

for content in "${content[@]}"
do
download_file $content "content"
done

for dns in "${dns[@]}"
do
download_file $dns "dns"
done

#修复换行符问题
sed -i 's/\r//' ./content/*.txt

echo 'Finish'

exit

0 comments on commit f0de044

Please sign in to comment.