In my 4 years of college, my university never announced the result dates. This being the last year everyone is anxious as the results decide if we get to sit in campus placements.
To save time constantly manually check the Pune University results webpage for updates, i wrote a small selenium script that constantly checks the website for results. This script can be easily generalized to check for an update on any website.
The following script looks for a specific result on the webpage.
Here's a more generalised version that checks for any change in the webpage contents.
To save time constantly manually check the Pune University results webpage for updates, i wrote a small selenium script that constantly checks the website for results. This script can be easily generalized to check for an update on any website.
The following script looks for a specific result on the webpage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import os | |
import time | |
url = 'http://results.unipune.ac.in/' | |
driver = webdriver.Firefox() | |
driver.get(url) | |
duration = 1 # second | |
freq = 440 # Hz | |
""" | |
Check for a specific change | |
""" | |
while 1: | |
try: | |
driver.get(url) | |
src1 = driver.page_source | |
if "TE2015" in driver.page_source or "TE 2015" in driver.page_source: | |
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % (duration, freq)) | |
except: | |
pass | |
time.sleep(20) |
Here's a more generalised version that checks for any change in the webpage contents.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import os | |
import time | |
url = 'http://results.unipune.ac.in/' | |
driver = webdriver.Firefox() | |
driver.get(url) | |
#beep sound vars | |
duration = 1 # second | |
freq = 440 # Hz | |
""" | |
Check for any change | |
""" | |
srcOld = "" | |
srcNew = "" | |
while 1: | |
try: | |
srcOld = srcNew | |
driver.get(url) | |
srcNew = driver.page_source | |
if srcNew != srcOld: | |
while(1): | |
os.system('play --no-show-progress --null --channels 1 synth %s sine %f' % (duration, freq)) | |
sleep(1) | |
except: | |
pass | |
time.sleep(20) #Check for updates every 20 seconds |
Comments
Post a Comment