Skip to content

Instantly share code, notes, and snippets.

@nibalizer
Created January 23, 2011 15:20
Show Gist options
  • Save nibalizer/792142 to your computer and use it in GitHub Desktop.
Save nibalizer/792142 to your computer and use it in GitHub Desktop.
we needz jorbs!
#!/usr/bin/python2.7
from BeautifulSoup import BeautifulSoup
import urllib2
import re
import time
pause = 30 #seconds
awesum_jorbs = {}
def sub_signal(jorb_id):
print("New Job: {0}, {1}, {2}.".format(*awesum_jorbs[jorb_id]))
while(True):
f = urllib2.urlopen('https://employment.pps.k12.or.us/ats/job_board?refresh=Y&COMPANY_ID=00002736&APPLICANT_TYPE_ID=00000001')
s = f.readlines()
f.close()
soup = BeautifulSoup(''.join(s))
jorbs = soup.findAll('tr')
jorbs = jorbs[2:]
#the dumb thing here is to len(jorbs)
#the smart thing would be to parse it and make content of text message out of info
#uhoh, what if one gets removed and another added? better go by name
#fuck it, throw 'er in a dict and move on with our lives
for jorb in jorbs:
jorb_dept = jorb.contents[-2].string
jorb_title = jorb.contents[-4].string
jorb_link = jorb.contents[1].contents[0].attrs[0][1]
jorb_id = int(re.search('210000\d\d\d\d', jorb_link).group(0))
if jorb_id not in awesum_jorbs:
awesum_jorbs[jorb_id] = (jorb_title, jorb_dept, jorb_link)
sub_signal(jorb_id)
print("Pausing for {0:03.2f} minutes.".format(pause / 60.))
time.sleep(pause)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment