Skip to content

Instantly share code, notes, and snippets.

@meetmangukiya
Created April 29, 2016 12:44
Show Gist options
  • Save meetmangukiya/ed114393326d420e3e24af4a6bb36401 to your computer and use it in GitHub Desktop.
Save meetmangukiya/ed114393326d420e3e24af4a6bb36401 to your computer and use it in GitHub Desktop.
import requests
import os
from time import sleep
url = input('Enter the url you want to track: ')
gap = int(input('Amount of time after which it should check for update(in seconds) : '))
print(
"""
To terminate the program press Cmd/Ctrl + C
"""
)
while True:
time = 0
content1 = requests.get(url) #Page source at time = 0
while True:
if (time) <= gap:
print('Time passed: ' + str(time))
sleep(10)
time += 10
else:
break
content2 = requests.get(url) #Page source after time = gap
if content1.content != content2.content: #Checks whether the page source has changed
os.system("send-notif 'There has been some changes'")
print('Changed')
else:
print('Not changed!')
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment