Notes:
-
Problem Solved: Monitors a webpage for any HTML/textual changes over time.
-
Customization Benefits: Set up alerts or track competitor website updates.
-
Further Adoption: Integrate with Slack/email APIs to send alerts.
Python Code:
import hashlib
import requests
import time
def get_page_hash(url):
response = requests.get(url)
return hashlib.sha256(response.text.encode()).hexdigest()
def track_changes(url, interval=60):
old_hash = get_page_hash(url)
print("Monitoring started...")
while True:
time.sleep(interval)
new_hash = get_page_hash(url)
if new_hash != old_hash:
print("Website content changed!")
break
else:
print("No change detected...")
# Example usage
# track_changes("https://example.com", interval=300)
No comments:
Post a Comment