注意:教程来源于用户上传,互联网收集,其中真实性注意斟酌,操作可能存在风险,请践行时注意保存资料防止丢失,如果本教程侵犯您的个人或者集体利益,请邮件fiimecn@163.com下架处理,非常感谢!
# -*- coding:utf-8 -*- import json import time import requests def get_rules(url_list): rules = set() for url in url_list: print("正在下载:%s" % url) try: response = requests.get(url).text except Exception: print("下载失败:%s" % url) continue print("共 %s条规则" % len(response.split("\n"))) for line in response.split("\n"): if not line.startswith("!") or \ not line.startswith("["): rules.add(line) return list(rules) def make_file(rules): print("文件合成中:") li = [] id = 1 for i in rules: date = { "id": id, "flag": 0, "rule": i, "updateTime": int(time.time() * 1000 - 1000), "network": 255, "effectiveTime": int(time.time() * 1000) } li.append(date) id += 1 print("已生成%s条广告过滤规则" % id) data = {"data": li} with open("./miui_blacklist.json", "w", encoding="utf-8") as f: json.dump(data, f) if __name__ == '__main__': url_list = ["https://easylist-downloads.adblockplus.org/easylistchina+easylistchina_compliance+easylist.txt", "https://easylist-downloads.adblockplus.org/easylist.txt", "https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt", ] rules = get_rules(url_list) make_file(rules) 感谢您的认可---来源请保留! From:https://fiime.cn/
一个生成miui浏览器广告过滤规则文件的简单脚本
将文件替换 /data/data/com.android.browser/files/data/adblock/ 路径下的同名文件即可
没有评论数据