【发布时间】:2022-02-08 04:54:18
【问题描述】:
我目前正在努力争取一个 Zoom 课程的名额,如果我没有名额,我欠驾驶学校 300 美元。长篇大论,但不是很重要。如果缩放注册链接数据已更新,我正在尝试获取通知。我最初试图查看网站的哈希是否在任何时候更新,但我注意到肯定有一些内部时钟发生了变化,让它每分钟通知我一次。我要查看是否将其删除的特定元素是...
<div class="form-group registration-over">Registration is closed.</div>
我不确定如何在哈希中隔离它。以下是我用于检查任何更新的代码。
import time
import hashlib
from urllib.request import urlopen, Request
import webbrowser
url = Request('URL HERE',
headers={'User-Agent': 'Mozilla/5.0'})
response = urlopen(url).read()
currentHash = hashlib.sha224(response).hexdigest()
print("running")
time.sleep(10)
while True:
try:
response = urlopen(url).read()
currentHash = hashlib.sha224(response).hexdigest()
time.sleep(30)
response = urlopen(url).read()
newHash = hashlib.sha224(response).hexdigest()
if newHash == currentHash:
continue
else:
from datetime import datetime
now = datetime.now()
nowtime = now.strftime("%H:%M:%S: ")
print(nowtime, "Something changed")
webbrowser.open('URL HERE')
response = urlopen(url).read()
currentHash = hashlib.sha224(response).hexdigest()
time.sleep(30)
continue
except Exception as e:
print("error")
【问题讨论】: