Created
February 4, 2013 21:57
-
-
Save scumola/4710076 to your computer and use it in GitHub Desktop.
Script to poll the ingress codes page for new codes on OSX - original here: http://pastebin.com/SCbwdgRa
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
#!/opt/local/bin/python | |
checkevery=120 # google doesn't seem to get too upset about every 2 minutes... | |
import urllib,time,os | |
def clipboard(text): | |
command = 'echo ' + text.strip() + '| clip' | |
os.system(command) | |
latestpasscode = "" | |
while True: | |
f = urllib.urlopen("https://plus.google.com/u/0/111701852247617430859/posts") | |
s = f.read() | |
f.close() | |
if s.find("Passcode: ") != -1: | |
passcodestart = s.find("Passcode: ") | |
firstend = s.find('>',passcodestart) | |
secondend = s.find('>',firstend+1) | |
endcode = s.find('<',secondend+1) | |
passcode = s[secondend+1:endcode] | |
if passcode != latestpasscode: | |
t = time.localtime() | |
print time.strftime("%a, %d %b %I:%M%p",t), passcode | |
latestpasscode = passcode | |
time.sleep(checkevery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment