This repository was archived by the owner on Feb 20, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 22
33此文件夹存放与主程序无关的额外脚本,用于获取域名数据
44
5- - get_whois_server_list 用于获取最新 TLD 和其对应 WHOIS Server 的对应关系
5+ - get_whois_server_list 用于获取最新 TLD 和其对应 WHOIS Server 的对应关系,以及保存 PSL
66- travellings-cn-api 处理 [ 开往] ( travellings.cn ) 项目成员列表的 all.json
Original file line number Diff line number Diff line change @@ -74,6 +74,27 @@ async def main():
7474 f'"{ tld_and_whois_server [0 ]} ":"{ tld_and_whois_server [1 ]} ",\n '
7575 )
7676 suffix_list .write ("}" )
77+ print ("✅ WHOIS Servers written to whois_server_list.py" )
78+
79+ # get PSL
80+ async with aiohttp .ClientSession (connector = connector ) as session :
81+ print ("try to get PSL..." )
82+ public_suffix_list_dat : str = await fetch (
83+ session , "https://publicsuffix.org/list/public_suffix_list.dat" , semaphore
84+ )
85+ print ("✅ Got PSL" )
86+
87+ public_suffix_list = []
88+ for line in public_suffix_list_dat .splitlines ():
89+ if line and not line .startswith ("//" ):
90+ public_suffix_list .append (line .strip ())
91+
92+ with open ("public_suffix_list.py" , "a" , encoding = "utf-8" ) as suffix_list :
93+ suffix_list .write ("public_suffix_list: list[str] = {\n " )
94+ for public_suffix in public_suffix_list :
95+ suffix_list .write (f'"{ public_suffix } ",\n ' )
96+ suffix_list .write ("}" )
97+ print ("✅ Public Suffix List written to public_suffix_list.py" )
7798
7899
79100if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments