Create twnic_rpz_1.0.py

This commit is contained in:
rootmelo92118 2023-07-29 21:45:28 +08:00 committed by GitHub
parent 62ee1c1482
commit 667d6acbd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,17 @@
import requests, json
from bs4 import BeautifulSoup
soup = BeautifulSoup(requests.get("https://rpz.twnic.tw/e.html").text, "html.parser")
exec(str(soup.find("script")).split(";")[0].split("const ")[1])
twnic_rpz_1_0_raw = ""
twnic_rpz_1_0_AdGuardHome = ""
for i in rpzdata:
for datap in i["domains"]:
twnic_rpz_1_0_raw += datap + "\n"
twnic_rpz_1_0_AdGuardHome += "||" + datap + "^\n"
with open("twnicRPZ1.0RAW.txt","a") as f:
f.write(twnic_rpz_1_0_raw)
f.close()
with open("twnicRPZ1.0AGH.txt","a") as f:
f.write(twnic_rpz_1_0_AdGuardHome)
f.close()