Back to blog
Augustas Pelakauskas
Product tracking, dynamic pricing, MAP monitoring - the use cases for e-commerce data are plentiful. This guide showcases how to extract product data from Best Buy at scale and in real time.
With Best Buy Scraper API, you can extract search results, reviews, product data, and monitor prices maintenance-free. Read on for scraping considerations and code samples in Python.
What is Best Buy?
Best Buy is a worldwide consumer electronics retailer with shops across the US, Canada, and Mexico. At Best Buy, you can browse and buy items from an extensive selection, including electronics, appliances, and entertainment.
The scraping target – a Best Buy search page – lists different products against a search query. The screenshot below highlights different parts of the page.
Best Buy page structure
In the image above, a search query “4k monitor” lists all the available 4K monitors in the store and their product attributes.
The attributes are:
Product Title
Product Model, SKU, and its Rating
Product Shipping and Pickup Information
Product Price
Product Image
Best Buy is a public data source available for fair use as defined in the legislation of the country the data collection is conducted in. To ensure you’re in line with the terms of service and applicable laws regarding web data extraction, the Oxylabs team suggests seeking professional legal guidance. Also, check our blog post on the topic: is web scraping legal?
The most important consideration when accessing Best Buy is limited locations. The website is only available in the US, Canada, and Mexico, prompting you to use proxies for geotargeting.
Moreover, in addition to proxies, you should consider auxiliary measures, such as browser fingerprinting, to avoid being blocked while scraping. Luckily, Oxylabs Scraper APIs come with in-built AI-powered anti-blocking solutions.
To scrape a Best Buy product page with Best Buy Scraper API, send an HTTP POST request to the API with a proper payload and wait for the response. The API scrapes the target page on your behalf and returns a response with the desired data. You can further parse this response to extract structured data.
Your system should run Python 3.6+ with the Requests library installed. You can install Requests using the pip install requests command.
Make sure you have valid user credentials to use the API. You can register for a free trial by visiting the Best Buy API page and clicking the Get free trial button.
To scrape data from a product page, first, create the payload structure. Keep in mind to use the universal_ecommerce source of E-Commerce Scraper API. To learn more about source attributes, visit our documentation.
payload = {
'source': 'universal_ecommerce',
'url': 'https://www.bestbuy.com/site/searchpage.jsp?st=4k+monitor&_dyncharset=UTF-8&_dynSessConf=&id=pcat17071&type=page&sc=Global&cp=1&nrp=&sp=&qp=&list=n&af=true&iht=y&usc=All+Categories&ks=960&keys=keys',
'geo_location': 'United States',
}
When the payload structure is ready, create a request by passing your Scraper API’s authentication key:
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('username', 'password'),
json=payload,
)
The POST request to the API returns a Requests response object. You can export HTML content from this response to a text file using the following script:
with open('bestbuy_4K_monitor.txt', 'w') as f:
f.write(response.json()['results'][0]['content'])
Let’s put the entire code together and see the output:
import requests
# Structure a payload.
payload = {
'source': 'universal_ecommerce',
'url': 'https://www.bestbuy.com/site/searchpage.jsp?st=4k+monitor&_dyncharset=UTF-8&_dynSessConf=&id=pcat17071&type=page&sc=Global&cp=1&nrp=&sp=&qp=&list=n&af=true&iht=y&usc=All+Categories&ks=960&keys=keys',
'geo_location': 'United States',
}
# Get a response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('username', 'password'),
json=payload,
)
with open('bestbuy_4K_monitor.txt', 'w') as f:
f.write(response.json()['results'][0]['content'])
The following is a partial view of the output text file:
A text file with HTML content
Best Buy Scraper API is a powerful tool for scraping content from Best Buy’s product pages. It's a warranted solution for easier, faster, more reliable, and highly scalable product data collection.
For more e-commerce targets, check how to scrape data from Walmart and Etsy.
Make sure to get a one-week Best Buy API trial for free. If you have any questions regarding the actions in this guide or want to know more about our Scraper APIs, drop a line via the 24/7 live chat on our home page or send us an email.
About the author
Augustas Pelakauskas
Senior Copywriter
Augustas Pelakauskas is a Senior Copywriter at Oxylabs. Coming from an artistic background, he is deeply invested in various creative ventures - the most recent one being writing. After testing his abilities in the field of freelance journalism, he transitioned to tech content creation. When at ease, he enjoys sunny outdoors and active recreation. As it turns out, his bicycle is his fourth best friend.
All information on Oxylabs Blog is provided on an "as is" basis and for informational purposes only. We make no representation and disclaim all liability with respect to your use of any information contained on Oxylabs Blog or any third-party websites that may be linked therein. Before engaging in scraping activities of any kind you should consult your legal advisors and carefully read the particular website's terms of service or receive a scraping license.
Get the latest news from data gathering world
Try Best Buy Scraper API
Choose Oxylabs' Best Buy Scraper API to gather real-time public data hassle-free.
Scale up your business with Oxylabs®
GET IN TOUCH
General:
hello@oxylabs.ioSupport:
support@oxylabs.ioCareer:
career@oxylabs.ioCertified data centers and upstream providers
Connect with us
Advanced proxy solutions
Resources
Innovation hub