我要做的是制作一个程序,该程序可以访问网站https://www.dan.me.uk/tornodes,获取该网站上的 Tor 节点 IP 地址并检查我的IP 地址列表。
使用 Python
import requests
from bs4 import BeautifulSoup
page = requests.get('https://www.dan.me.uk/tornodes')
if "<!--__BEGIN_TOR_NODE_LIST__-->" not in page.content:
print("LIST IS NOT READY")
else:
list_text = page.content.split("<!--__BEGIN_TOR_NODE_LIST__-->")[1] #TAKES EVERYTHING AFTER THIS
list_text = list_text.split("<!--__END_TOR_NODE_LIST__-->")[1] #TAKES EVERYTHING BEFORE THIS
line_list = [line.strip() ]
for line in list_text.split("<br>"):
line_ip = line.strip().split("|")[0]
#DO WHAT YOU WANT NOW
if line_ip in my_known_ip_list:
print("THIS IS GOOD" % line_ip)
非常感谢提前给我的任何帮助。