AWAvenue-Ads-Rule/script/RouterOS-Adlist.py
elysias123 aef319700f
Some checks failed
build Rule / execute_python_script (push) Has been cancelled
移除无效域名查询(action无法判断正确判断是否有效)
2025-05-19 15:22:01 +08:00

15 lines
444 B
Python
Executable File

import json
def format_domain(List):
domain = ["0.0.0.0 localhost", "::1 localhost", "", ""]
for line in List:
domain_lines = f"0.0.0.0 {line.strip()}"
domain.append(domain_lines)
domain_lines = f":: {line.strip()}"
domain.append(domain_lines)
return domain
def build(rule):
list = format_domain(rule.domain_list)
return {'list': list, 'suffix': '.txt', 'comment': '#', 'total': len(list)}