import requests, re, webbrowser
cookies = {
# 你的cookies
}
headers = {
# 你的headers
}
problem_id = 3899 # 要搜索的ID
r = re.compile(
'100.{0,150}<a href="(#main/code/\\d+)">C\\+\\+.{0,80}<i\\ class="icon\\-globe"></i>'
)
for i in range(1, 21):
response = requests.get(
f"https://gmoj.net/senior/index.php/main/statistic/{problem_id}/{i}",
cookies=cookies,
headers=headers,
)
html = response.content.decode()
with open(".\other\oj.html", "w") as f:
f.write(html)
s = r.findall(html)
if s:
for i in s:
print("https://gmoj.net/senior/%s" % i)
webbrowser.open("https://gmoj.net/senior/%s" % i)