Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGL committed Jan 26, 2018
1 parent e2674d4 commit 9d17e3e
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions scraper.py
Expand Up @@ -34,11 +34,24 @@
#scraperwiki.sqlite.save(unique_keys=['age'], data=record, table_name="ages")

root = lxml.html.fromstring(html)
ages = root.cssselect("tr")
print ages
for age in ages:
div = age.text_content().encode('ascii','ignore')
if "years" in div:
sections = root.cssselect("tr")
for name in sections:
# print name.text
print name.text.encode('ascii', 'ignore')
print name.attrib['href']


#store the link in the variable 'record' under the key 'link'
#record['link'] = name.attrib['href']
#record['name'] = name.text.encode('ascii', 'ignore')
# print record
# scraperwiki.sqlite.save(unique_keys=['link'], data=record)


#print ages
#for age in ages:
#div = age.text_content().encode('ascii','ignore')
# if "years" in div:
print age.text.encode('ascii', 'ignore')
#record['ages'] = name.text.encode('ascii', 'ignore')
#print record
Expand Down

0 comments on commit 9d17e3e

Please sign in to comment.