网站上有什么变化?

问题描述

我想知道是否有一种方法可以让我监视站点的更改,而不是只收到“某些更改”的消息,我也会收到更改的消息。

我现在的代码是:

url = Request('https://stackoverflow.com',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:
            print("something changed")
  
            response = urlopen(url).read()
  
            currentHash = hashlib.sha224(response).hexdigest()
  
            time.sleep(30)
            continue
              
    except Exception as e:
        print("error")

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)