Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
watty62 committed Oct 12, 2016
1 parent ac49170 commit 177a15e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,23 @@
# # Read in a page
# scrape_add = ""

def extract_ints (s):
ret_int = [int(s) for s in str.split() if s.isdigit()]
return ret_int[1]

def scrape_URL (url_no):
scrape_add = "http://www.grampiancaredata.gov.uk/home?sobi2Task=sobi2Details&sobi2Id=" + str(url_no)
html = scraperwiki.scrape(scrape_add)
root = lxml.html.fromstring(html)

# for el in root:

#set up variables
rec_no = 0

# get the rec_no
el = root.cssselect("div#sobi2outer p")[0]
print el.text
rec_no = extract_ints (el.text)
print rec_no

return "true"

# lower_rec = 16
Expand Down

0 comments on commit 177a15e

Please sign in to comment.