Created
July 15, 2012 13:50
-
-
Save dhruvbaldawa/3117021 to your computer and use it in GitHub Desktop.
MU Result Checking Script
This file contains hidden or 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
import urllib2 | |
import time | |
import tweepy | |
import os | |
# Twitter Bot Credentials | |
# Refer on https://dev.twitter.com | |
consumer_key = '' | |
consumer_secret = '' | |
access_token = '' | |
access_secret = '' | |
tweet_string = '@dhruvbaldawa Result for %s (%s) declared.' # First place-holder for id, second for if its a computer result or not | |
url = 'http://results.mu.ac.in/choose_nob.php?exam_id=%s&exam_year=2012&exam_month=MAY' | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_secret) | |
t = tweepy.API(auth) | |
id_start = 2736 # RESULT ID TO START CHECKING FROM | |
id_ = id_start | |
while True: | |
url_socket = urllib2.urlopen(url % id_) | |
temp = url_socket.read().lower() | |
if temp.find('no such exam!!') < 0: # CHECK IF THE RESULT IS RELEASED | |
if temp.find('computer') > 0: # CHECK IF IT CONTAINS 'COMPUTER' IN IT | |
print(tweet_string % (id_, True)) | |
t.update_status(tweet_string % (id_, True)) | |
os.system("vlc ~/01.mp3") # PLAY SOME NICE MUSIC | |
else: | |
print(tweet_string % (id_, False)) | |
t.update_status(tweet_string % (id_, False)) | |
id_ += 1 | |
else: | |
time.sleep(300) # WAIT FOR 5MINS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do I place this code inorder to get my score? I am from Computer Engineering too from Mumbai University