Skip to content

Commit

Permalink
Fork of code from ScraperWiki at https://classic.scraperwiki.com/scra…
Browse files Browse the repository at this point in the history
  • Loading branch information
kayjax84 committed Oct 2, 2018
0 parents commit 92b7009
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
# Ignore output of scraper
data.sqlite
33 changes: 33 additions & 0 deletions scraper.py
@@ -0,0 +1,33 @@
import scraperwiki
import scraperwiki
import lxml.html
import uuid
import datetime

# Blank Python

ASINS = ["B0018AA9CU","B0018A7F8Q","B000KNFR2S","B00112VEA6","B000CO89T8"]
summary = ""

for asin in ASINS:
url = "http://www.amazon.com/dp/"+asin
html = scraperwiki.scrape(url)
root = lxml.html.fromstring(html)
for title in root.cssselect("span[id='btAsinTitle']"):
summary += title.text +": "
break
for price in root.cssselect("span[id='actualPriceValue'] b"):
summary += price .text +"<br>"
break
summary += url + "<br>"

now = datetime.datetime.now()
data = {
'link': "http://www.amazon.com/"+"&uuid="+str(uuid.uuid1()),
'title': "Price Monitoring " + str(now),
'description': summary,
'pubDate': str(now) ,
}
scraperwiki.sqlite.save(unique_keys=['link'],data=data)


0 comments on commit 92b7009

Please sign in to comment.