Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongs committed Jun 9, 2015
1 parent ba069e4 commit d022853
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scraper.py
Expand Up @@ -12,11 +12,11 @@

data = []
for i, a in enumerate(agentps):
if len(a.find_all("br"))>3:
if a.find_all("br")[0].previousSibling.strip() == 'New South Wales':
data.append({"id": i, name": a.find_all("br")[1].nextSibling.strip(), "company": a.find_all("br")[2].nextSibling.strip(), "location": a.find_all("br")[-1].nextSibling.strip().replace(u'\xa0', u' ')})
else:
data.append({"id": i, "name": a.find_all("br")[0].previousSibling.strip(), "company": a.find_all("br")[1].previousSibling.strip(), "location": a.find_all("br")[-1].nextSibling.strip().replace(u'\xa0', u' ')})
if len(a.find_all("br"))>3:
if a.find_all("br")[0].previousSibling.strip() == 'New South Wales':
data.append({"id": i, "name": a.find_all("br")[1].nextSibling.strip(), "company": a.find_all("br")[2].nextSibling.strip(), "location": a.find_all("br")[-1].nextSibling.strip().replace(u'\xa0', u' ')})
else:
data.append({"id": i, "name": a.find_all("br")[0].previousSibling.strip(), "company": a.find_all("br")[1].previousSibling.strip(), "location": a.find_all("br")[-1].nextSibling.strip().replace(u'\xa0', u' ')})

scraperwiki.sqlite.save(unique_keys=["name","company"], data=data, table_name='agents')

0 comments on commit d022853

Please sign in to comment.