Amazon crawls Amazon page information
Code:
#-*-coding: cp936-*-
Import requests
From lxml import etree
ASIN = 'B00X4WHP5E'
# ASIN = 'B017R1YFEG'
Url = 'https://www.amazon.com/dp/'+ASIN
R = requests.get (url)
Html = r.text
Tree = etree.HTML (html)
# obtain product unit price
Span = tree.xpath ("/ / span [@ id='priceblock_ourprice'] / text ()")
Print "ASIN Code:", ASIN
Print "Unit Price:", span
# obtain product customer reviews
Cus_reviewList = tree.xpath ("/ / div [@ id='averageCustomerReviews'] / span/a/span [@ id='acrCustomerReviewText'] / text ()")
Print "Customer Reviews:", cus_reviewList [0]
# obtain product kc