How To Scrape Amazon Product Data and Pricing using Python

# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'}
url = 'https://www.amazon.com/Victrola-Bluetooth-Suitcase-Turntable-Turquoise/dp/B00UMVVUOC?pf_rd_p=f62b9627-0b3f-409a-81f2-c4d5e3c556d9&pd_rd_wg=oc1cu&pf_rd_r=FYVCAGRDA22E1G9T400R&ref_=pd_gw_unk&pd_rd_w=oaPrK&pd_rd_r=c678cac3-201d-4cc6-a88f-0a453f156cd5'
response=requests.get(url,headers=headers)
soup=BeautifulSoup(response.content,'lxml')
print('Title: ' soup.select('#productTitle')[0].get_text().strip())
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9'}
url = 'https://www.amazon.com/Victrola-Bluetooth-Suitcase-Turntable-Turquoise/dp/B00UMVVUOC?pf_rd_p=f62b9627-0b3f-409a-81f2-c4d5e3c556d9&pd_rd_wg=oc1cu&pf_rd_r=FYVCAGRDA22E1G9T400R&ref_=pd_gw_unk&pd_rd_w=oaPrK&pd_rd_r=c678cac3-201d-4cc6-a88f-0a453f156cd5'
response=requests.get(url,headers=headers)
soup=BeautifulSoup(response.content,'lxml')#print(soup.select('.a-carousel-card')[0].get_text())try: print('Title: ' soup.select('#productTitle')[0].get_text().strip())
print('Original price: ' soup.select('.priceBlockStrikePriceString')[0].get_text().strip())
print('Discounted price: ' soup.select('#priceblock_ourprice')[0].get_text().strip())
print('Shipping: ' soup.select('#ourprice_shippingmessage .a-color-secondary')[0].get_text().strip())
print('Features follow:')
for item in soup.select('#feature-bullets li'):
print('\t' item.select('.a-list-item')[0].get_text().strip())
except Exception as e:
raise e
print('')
  • With millions of high speed rotating proxies located all over the world
  • With our automatic IP rotation
  • With our automatic User-Agent-String rotation (which simulates requests from different, valid web browsers and web browser versions)
  • With our automatic CAPTCHA solving technology
curl "http://api.proxiesapi.com/?key=API_KEY&url=https://example.com"

--

--

--

Founder @ ProxiesAPI.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Managing Site Hierarchy with SharePoint Hub Sites

Introducing Donor Compliance Marker Feature on AidStream

Full-time Developer by day and Community Builder by night: How Gopikrishnan Juggles Roles while…

Setting up an AWS VPC

8 months of Software Engineering in San Francisco

Join us in the IBM Cloud Garage at Think 2018

DeNations Discord Server Open

Alooma + Snowflake: A Dynamic Duo For Building A Cloud-Based Data Warehouse

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mohan Ganesan

Mohan Ganesan

Founder @ ProxiesAPI.com

More from Medium

Build a dataset from scratch by web scraping in Python

Web Scraping Overview

Web Scraping with Python: An Absolute Beginner’s Guide on Building an End-to-End Web Scraper for…

Business Sales Analysis Web App