-
Notifications
You must be signed in to change notification settings - Fork 1
/
scraper.py
33 lines (27 loc) · 863 Bytes
/
scraper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)