Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests, bs4
- def getAmazonPrice(productUrl):
- res = requests.get(productUrl)
- res.raise_for_status()
- soup = bs4.BeautifulSoup(res.text,'html.parser')
- elems = soup.select('#newOfferAccordionRow > div > a > h5 > div > div.a-column.a-span7.a-text-right.a-span-last > span.a-size-medium.a-color-price.header-price')
- return elems[0].text.strip()
- price = getAmazonPrice('http://www.amazon.com/Automate-Boring-Stuff-Python-Programming/dp/1593275994/ref=sr_1_1?ie=UTF8&qid=1444714975&sr=8-1&keywords=automate+python')
- print 'The price is ' + price
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement