Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
LeifGreiss committed Dec 1, 2017
1 parent 768a22b commit d7b629f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scraper.py
@@ -1,13 +1,13 @@
import scraperwiki
html = scraperwiki.scrape('http://inmo.ie/6022')
html = scraperwiki.scrape('https://en.wikipedia.org/wiki/List_of_British_racecourses')
import lxml.html
root = lxml.html.fromstring(html)#turnourHTMLintoanlxmlobject
trs = root.cssselect('tr')#getallthe<tdtags
for tr in trs:
print tr.text_content()
for tr in trs:
record = { "tr" : tr.text_content() } # column name and value try:
scraperwiki.sqlite.save(["tr"], record)
tds = root.cssselect('td')#getallthe<tdtags
for td in tds:
print td.text_content()
for td in tds:
record = { "td" : td.text_content() } # column name and value try:
scraperwiki.sqlite.save(["td"], record)
#try:
#scraperwiki.sqlite.save(["td"], record) # save the records one by one
#except:
Expand Down

0 comments on commit d7b629f

Please sign in to comment.