Skip to content

Commit

Permalink
add Adblock
Browse files Browse the repository at this point in the history
  • Loading branch information
elysias123 committed Feb 7, 2024
1 parent 3f554cc commit b8f0bd9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python main.py
cd out
mkdir Filters
mv AWAvenue-Ads-Rule-Adguard.txt AWAvenue-Ads-Rule.txt #历史遗留问题
cp -Rf AWAvenue-Ads-Rule-Adblock.txt AWAvenue-Ads-Rule.txt #历史遗留问题
mv AWAvenue-Ads-Rule-* Filters/
cd Filters
wget -O ./sing-box.tar.gz https://github.com/SagerNet/sing-box/releases/download/v1.8.2/sing-box-1.8.2-linux-amd64.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"title": "Title: AWAvenue 秋风广告规则(AWAvenue-Ads-Rule)\n规则版本: version\n更新时间: format_time\n\n项目地址:https://github.com/TG-Twilight/AWAvenue-Ads-Rule\n\n如果需要在其它规则中混合此规则,请在您的规则显眼处注明本规则的出处,谢谢!\n加入Telegram群组 秋風がく山道 (@AWAvenueAdsChat) 与编写者交流,期待着您的到来!\n群组链接:https://t.me/AWAvenueAdsChat\n订阅Telegram频道 AWAvenue Ads Rule (@AWAvenueAdsRule) 获取最新公告,期待着您的订阅!\n频道链接:https://t.me/AWAvenueAdsRule\n\nThis project is licensed under the Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.\n\n倾城极速 - 畅游世界,高速互联!官网:https://wcnmdmht.lol/sb 官网2:https://panel.qc02.xyz\n",
"suffix": [
{"name": "AdClose", "suffix": ".txt", "comment": "!"},
{"name": "Adguard", "suffix": ".txt", "comment": "!"},
{"name": "Adblock", "suffix": ".txt", "comment": "!"},
{"name": "Clash", "suffix": ".yaml", "comment": "#"},
{"name": "hosts", "suffix": ".txt" , "comment": "#"},
{"name": "Surge", "suffix": ".txt" , "comment": "#"},
Expand Down
23 changes: 23 additions & 0 deletions script/Adblock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
def format_domain(domain_file):
domain = []
with open(domain_file, 'r') as file:
lines = file.readlines()
for line in lines:
domain_lines = f"||{line.strip()}^"
domain.append(domain_lines)
return domain


def format_regex(regex_file):
regex = []

with open(regex_file, 'r') as file:
lines = file.readlines()
for line in lines:
regex_lines = f"/{line.strip()}/".replace("\.","\\\.").replace("\*","\.\*")
regex.append(regex_lines)
return regex

def build(domain_file, regex_file):
Adblock_list = format_domain(domain_file) + format_regex(regex_file)
return Adblock_list

0 comments on commit b8f0bd9

Please sign in to comment.