How to Extract Walmart Sponsored Ads
Published: 2023-12-13 15:10:23

---
title: How to Extract Walmart Sponsored Ads
published: true
cover_image: https://crawlbase.com/blog/walmart-sponsored-ads-scraping/walmart-ppc-ads.jpg
description: 
tags: 
# cover_image: https://crawlbase.com/blog/walmart-sponsored-ads-scraping/walmart-ppc-ads.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-12-13 14:58 +0000
---

This blog was originally posted to [Crawlbase Blog](https://crawlbase.com/blog/walmart-sponsored-ads-scraping/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution)


Walmart-Sponsored Ads are a key component of Walmart's advertising platform, allowing sellers to promote their products to a broader audience. Through strategic placements on the Walmart website, these paid ads enable sellers to capture the attention of potential customers actively searching or browsing for products.

<!-- more -->

In this blog post, we’ll explore the importance of extracting data from Walmart-Sponsored Ads for businesses and marketers using JavaScript and [Crawlbase Crawling API](https://crawlbase.com/crawling-api-avoid-captchas-blocks/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Crawlbase Crawling API'). By [Scraping Walmart](https://crawlbase.com/blog/scraping-walmart-developers-roadmap/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart') and obtaining details like product information, [pricing](https://crawlbase.com/blog/how-scrape-walmart-prices-easily/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart prices'), ad performance metrics, and [Walmart best sellers](https://crawlbase.com/blog/scrape-walmart-best-sellers/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart best sellers'), you can gain valuable insights into market trends and consumer behavior. Extracted data empowers sellers to make informed decisions, refine their ad campaigns, and stay competitive in the dynamic e-commerce landscape.

To jump straight into the process of extracting Walmart Sponsored Ads data, click here.

### Table of Contents

- **[Data Elements to Extract](#Data-Elements-to-Extract)**
- **[Setting Up the Environment](#Setting-Up-the-Environment)**
- **[Crawling Walmart Sponsored Ads Page HTML](#Crawling-Walmart-Sponsored-Ads-Page-HTML)**
  - Extracting meaningful information from HTML
  - Extracting Walmart Sponsored Ads Data
- **[Ensuring Data Accuracy](#Ensuring-Data-Accuracy)**
  - Best Practices for Reliable Extraction
  - Quality Assurance Techniques
- **[Filtering and Organizing Data](#Filtering-and-Organizing-Data)**
  - Tips for Effective Data Organization
  - Filtering techniques for analysis
- **[Final Words](#Final-Words)**
- **[Frequently Asked Questions](#Frequently-Asked-Questions)**

### Walmart Data Elements to Extract

Walmart Advertising involves capturing various key elements that provide comprehensive insights into the advertised products and their performance. Here are the essential data elements to extract:


![Image description](https://crawlbase.com/blog/walmart-sponsored-ads-scraping/extract-walmart-data-elements.jpg)

- **Extract Walmart Product Details:**

  Extract detailed [Walmart Product data](https://crawlbase.com/blog/scrape-walmart-product-page-with-selenium/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart product data') information about the sponsored [search](https://crawlbase.com/blog/scrape-walmart-search-with-python/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart search with Python'), including product names, descriptions, and specifications. Understanding the nuances of each product enhances the overall dataset.

- **Extract Walmart Pricing Information:**

  [Scrape Walmart pricing details](https://crawlbase.com/blog/how-scrape-walmart-prices-easily/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart prices') associated with the sponsored products. This includes regular prices, any discounted prices, and details of special offers or promotions. Accurate pricing information is critical for market analysis and competitive positioning.

- **Extract Walmart Promotional Text:**

  Retrieve any promotional or advertising text associated with the sponsored products. This could include taglines, special offers, or unique selling propositions that sellers use to attract customers.

- **Extract Walmart Product Images:**

  Gather images associated with the sponsored products. Images play a significant role in influencing customer decisions, and having access to visuals can enhance the quality of your dataset.

- **Extract Walmart Ad Performance Metrics:**

  Extract metrics related to the performance of the sponsored ads. This includes data such as click-through rates, impressions, and conversion rates. Analyzing these metrics provides valuable insights into the effectiveness of the advertising campaign.

### Setting Up the Environment

**Sign Up on Crawlbase:**

Go to [Crawlbase](https://crawlbase.com/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Crawlbase') and sign up for a free account. You can get your private token in the account documentation section.

**Install Crawlbase Node.js Library:**

Make sure you have [Node.js](https://nodejs.org/en 'Node.js') installed on your computer. If not, download and install it from the official Node.js website. Once installed, open your terminal and type the following command:

`npm install crawlbase`

This command will download and install the Crawlbase Node.js library on your computer.

**Create a File for Walmart Scraper:**

Use a text editor or an IDE to create a file named "walmart-scraper.js." If you're using the command line, run:

`touch walmart-scraper.js`

This command creates an empty file. Open it with your preferred text editor to add your JavaScript code for scraping Walmart Sponsored Ads data.

## Crawling Walmart Sponsored Ads Page HTML

Now that you have your API credentials, installed the Crawlbase Node.js library, and made the "walmart-scraper.js" file, let's choose which Walmart page to scrape. We'll be looking at the Walmart search results page for "[headphones](https://www.walmart.com/search?q=headphones 'Walmart search results page')" in this example. Just make sure to pick a search page with lots of sponsored ads. This will show how flexible and useful the scraping process can be.

![Image description](https://crawlbase.com/blog/walmart-sponsored-ads-scraping/walmart-headphones-search-page.jpg)

To start using the Crawlbase Crawling API, make sure you set up the necessary details like parameters and endpoints. First, double-check that you made the "walmart-scraper.js" file, following the steps mentioned earlier. Once your file is good to go, copy and paste the script given below into it.

After adding the script, go ahead and run it in your terminal. Just type `node walmart-scraper.js` and hit enter. This command will make the script run and begin scraping HTML of Walmart search results page.

```javascript
// Import the Crawling API
const { CrawlingAPI } = require('crawlbase');

// Set your Crawlbase token
const api = new CrawlingAPI({ token: 'YOUR_CRAWLBASE_TOKEN' });

// URL of the Walmart page to scrape
const walmartPageURL = 'https://www.walmart.com/search?q=headphones';

// Get request to crawl the URL
api
  .get(walmartPageURL)
  .then((response) => {
    if (response.statusCode === 200) {
      console.log(response.body);
    }
  })
  .catch((error) => console.error);
```

The script above guides you on using Crawlbase's Crawling API to get information from a Walmart headphones search results page. It includes steps like getting the API token, stating the web link you want info from, and starting the process with a GET request. When you run this code, the result you'll see in the console is the basic HTML content of the chosen Walmart search results page.

**HTML Response:**

![Image description](https://crawlbase.com/blog/walmart-sponsored-ads-scraping/html-terminal-response.jpg)

### Extracting meaningful information from HTML

In the previous example, we explored how to get the basic structure of the Walmart headphones search results page, which is essentially the HTML code of the webpage. However, there are times when we don't need this raw data; instead, we just want the important information from the page. Luckily, the Crawlbase Crawling API has special parameters to scrape this crucial content from Walmart pages.

To make this happen, you need to add an ["autoparse" parameter](https://crawlbase.com/docs/crawling-api/parameters/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Crawlbase Crawling API parameters') when using the Crawling API. This parameter is specifically designed to help you pull out the essential elements of the page in a JSON format. To do this, you can make changes to the same file, "walmart-scraper.js". Let's check out the example below for a clearer idea.

```javascript
// Import the Crawling API
const { CrawlingAPI } = require('crawlbase');

// Set your Crawlbase token
const api = new CrawlingAPI({ token: 'YOUR_CRAWLBASE_TOKEN' });

// URL of the Walmart page to scrape
const walmartPageURL = 'https://www.walmart.com/search?q=headphones';

// options for Crawling API
const options = {
  autoparse: 'true',
};

// Get request to crawl the URL
api
  .get(walmartPageURL, options)
  .then((response) => {
    if (response.statusCode === 200) {
      // Parse the JSON response and print it
      console.log(JSON.parse(response.body));
    }
  })
  .catch((error) => {
    console.error('API request error:', error);
  });
```

**JSON Response:**

```json
{
  "original*status": 200,
  "pc_status": 200,
  "url": "https://www.walmart.com/search?q=headphones",
  "body": {
    "alert": "A generic web scraper has been selected. Please contact support if you require a more detailed scraper for your given URL.",
    "title": "headphones - Walmart.com",
    "favicon": "",
    "meta": {
      "description": "headphones - Walmart.com",
      "keywords": ""
    },
    "content": "22354.6 out of 5 Stars. 2235 reviews 20624.2 out of 5 Stars. 2062 reviews In-store Price Brand Speed 39984.3 out of 5 Stars. 3998 reviews Save with 22354.6 out of 5 Stars. 2235 reviews Save with Free shipping, arrives in 3+ days Options from $31.99 – $35.99 OneOdio Wired Over-Ear Headphones with Mic | Noise Cancelling Earcups & Studio DJ Headphones with Dual Ports for Computer-Black 19504.8 out of 5 Stars. 1950 reviews Save with Shipping, arrives in 2 days Was $39.99 OneOdio Wired over-Ear Headphones with Mic Dual Plugs & Deep Bass Sound for PC Laptop Phones-Red 5634.8 out of 5 Stars. 563 reviews Save with Free shipping, arrives in 2 days Options from $11.99 – $16.99 Mpow Kids Headphones with Microphone, Foldable 85/94dB Volume Limit 3D Stereo Adjustable Headband Soft Earcups over Ear Headphones for Kids, Share Function Wired Kids Headphones for School Tablet 2584.7 out of 5 Stars. 258 reviews Save with JLab Audio JBuddies Studio On-ear Kids Folding Headphones with Microphone, Volume Safe, Gray & Blue HJKSTUDIORGRYBLU6 13144.4 out of 5 Stars. 1314 reviews Save with Pickup available 13424.3 out of 5 Stars. 1342 reviews Save with Pickup available Shipping, arrives in 3+ days Options from $15.99 – $16.99 Wireless Earbuds, Bluetooth 5.0 Headphones IPX8 Waterproof, Hight-Fidelity Stereo Sound Quality in Ear Headset, Built-in Mic LED Charging Case & 21 Hours Playtime, for Smartphones Laptops Running Gym 22734.2 out of 5 Stars. 2273 reviews Save with 39984.3 out of 5 Stars. 3998 reviews Save with Related searches",
    "canonical": "",
    "images": [
      "//i5.walmartimages.com/dfw/63fd9f59-b3e1/7a569e53-f29a-4c3d-bfaf-6f7a158bfadd/v1/walmartLogo.svg",
      "//i5.walmartimages.com/dfw/63fd9f59-ac39/29c6759d-7f14-49fa-bd3a-b870eb4fb8fb/v1/wplus-icon-blue.svg",
      "https://i5.walmartimages.com/dfwrs/76316474-3850/k2-_c6d4aec7-b4a7-4ea4-9223-07c8daef4fcf.v1.png",
      "https://i5.walmartimages.com/dfw/9fa19e5c-b5/k2-_a1023be2-d16f-44fa-8f0f-c6c9c7ac10e6.v1.png?odnHeight=90&odnWidth=150&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/Bose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black_48e15895-cb0c-4a8a-b852-4c52dca7692a.5f403bdd71947a437bd6c8bafbb6b8d4.jpeg?odnHeight=150&odnWidth=150&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/Bose-Noise-Cancelling-Headphones-700-over-ear-Wireless-Bluetooth-Earphones-Black_136c356e-a18d-4aa7-bbec-515b2802082a.2f7333d860a9e8bf4c403ce55e49414c.jpeg?odnHeight=150&odnWidth=150&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/VILINICE-Noise-Cancelling-Headphones-Wireless-Bluetooth-Over-Ear-Headphones-with-Microphone-Black-Q8_0cd6ae5a-8ea9-4e46-8b5e-fffb7da5e6f5.d4808578fda9397ec198b2d5dec46404.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/Bose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black_48e15895-cb0c-4a8a-b852-4c52dca7692a.5f403bdd71947a437bd6c8bafbb6b8d4.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/OneOdio-Wired-Over-Ear-Headphones-with-Mic-Noise-Cancelling-Earcups-Studio-DJ-Headphones-with-Dual-Ports-for-Computer-Black_c13f91b6-ba42-4546-8b06-0830d3344826.3edeff9f7ccba89981515bb979dea386.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/OneOdio-Wired-over-Ear-Headphones-with-Mic-Dual-Plugs-Deep-Bass-Sound-for-PC-Laptop-Phones-Red_115b65f9-b03e-4593-a0c5-202151b7dc9b.1f3fa720cc8320abf4871411fe6916e6.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/Mpow-Kids-Headphones-Microphone-Foldable-85-94dB-Volume-Limit-3D-Stereo-Adjustable-Headband-Soft-Earcups-Ear-Kids-Share-Function-Wired-School-Tablet_4272d222-af66-48b2-9c91-f6df41d7e657.653881036ddc688395cbf4ca0f474d5e.gif?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/3381e5c8-b55b-42cc-b78f-323c64ce3047.9cd7fd2516bd6ca3c6d0a3da5834d986.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
      "https://i5.walmartimages.com/asr/7cbd2c20-c09a-449b-a323-8a154e5181e9.52dfbc37c15847a1f2b4579ed0ab9b79.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
      "https://i5.walmartimages.com/asr/98cd319b-0a96-41cb-89b7-7336031a3aad.08d842585156cf11fe7f697bd533402f.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
      "https://i5.walmartimages.com/asr/a6048703-eadb-4f5b-81f9-554979ca8a0a.69851709527ec9a0c40d26b00a2d86dd.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/JLab-Audio-JBuddies-Studio-On-ear-Kids-Folding-Headphones-with-Microphone-Volume-Safe-Gray-Blue-HJKSTUDIORGRYBLU6_ebb97b7a-3512-4dfa-8ca4-df7e3b97de13_1.1254787dc2ca28b7ddb470b5f06667a5.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/e6b637bf-5b7d-4ed3-8f03-f8b9a359eae9.29b93e7be9bb463e51c9a66fca039304.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/8c92c76e-a960-4efc-ad51-fcb9c89b44e0.102c174d9416e33088381411ae684629.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/a088fd41-4f78-437f-ae18-bcf60fac4769.834d0a2a501f90b721ab373a0cbe3bd3.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/onn-Wired-on-Ear-Headphones-Black-New_098585ca-4559-42cb-a21e-0e19ea73ea1a.534b8976456996f2d587afb956762b38.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/dbc9f833-9009-4e70-b9ae-a642796ad6bf.d7249fca19de34133a04ebc4f0e3ebd2.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/d8dfe380-dfbf-474d-a38b-1153dace5d21.70721549e4e32d92786c3bcf0a1b4582.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/754b2e4d-6f4a-437e-afb8-0c82eead22a9.14d10d8c6d6148284f7e56709ffe8077.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/seo/Wireless-Earbuds-Bluetooth-5-0-Headphones-IPX8-Waterproof-Hight-Fidelity-Stereo-Sound-Quality-Ear-Headset-Built-in-Mic-LED-Charging-Case-21-Hours-Pla_017730d9-daca-40cf-96e0-21b61e33c0c5.55e1476d137a8795b33560016427e499.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/017730d9-daca-40cf-96e0-21b61e33c0c5.55e1476d137a8795b33560016427e499.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
      "https://i5.walmartimages.com/asr/b4f59ae7-77ba-4b53-b23f-37f7e82975bd.1331b6c1773468e70657f0ee55a65ba8.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
      "https://i5.walmartimages.com/asr/4dcbe91c-b3e5-436a-8ac9-8f6c8df1e129.0db7b16a45b0e37dcb762ea92d03ebd1.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/asr/c51a9ac3-b08d-4699-85b8-c007b032377e.36b30f8eb2ff68115ae27f63732725a8.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
      "https://i5.walmartimages.com/dfw/4ff9c6c9-492b/k2-_d364fa80-6c6b-4a89-88ea-beaaf53a606e.v1.png?odnHeight=16&odnWidth=16&odnBg=FFFFFF",
      "//i5.walmartimages.com/dfwrs/76316474-f70e/k2-_67001355-c576-4ca2-989d-260a2673c41a.v1.png",
      "https://www.walmart.com/akam/13/pixel_5bda523a?a=dD1jYmJiODcxZDVkMTM1ZGMwOThhMGUzMWRmN2U0NzJiZGM2YzBmYjExJmpzPW9mZg=="
    ],
    "videos": [],
    "grouped_images": {
      "db": ["//i5.walmartimages.com/dfw/63fd9f59-b3e1/7a569e53-f29a-4c3d-bfaf-6f7a158bfadd/v1/walmartLogo.svg"],
      "mr2 f5": [
        "//i5.walmartimages.com/dfw/63fd9f59-ac39/29c6759d-7f14-49fa-bd3a-b870eb4fb8fb/v1/wplus-icon-blue.svg"
      ],
      "mr2 br-100 v-btm": [
        "https://i5.walmartimages.com/dfwrs/76316474-3850/k2-_c6d4aec7-b4a7-4ea4-9223-07c8daef4fcf.v1.png"
      ],
      "mw-none mb2": [
        "https://i5.walmartimages.com/dfw/9fa19e5c-b5/k2-_a1023be2-d16f-44fa-8f0f-c6c9c7ac10e6.v1.png?odnHeight=90&odnWidth=150&odnBg=FFFFFF"
      ],
      "mw-none": [
        "https://i5.walmartimages.com/seo/Bose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black_48e15895-cb0c-4a8a-b852-4c52dca7692a.5f403bdd71947a437bd6c8bafbb6b8d4.jpeg?odnHeight=150&odnWidth=150&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/Bose-Noise-Cancelling-Headphones-700-over-ear-Wireless-Bluetooth-Earphones-Black_136c356e-a18d-4aa7-bbec-515b2802082a.2f7333d860a9e8bf4c403ce55e49414c.jpeg?odnHeight=150&odnWidth=150&odnBg=FFFFFF",
        "https://i5.walmartimages.com/dfw/4ff9c6c9-492b/k2-_d364fa80-6c6b-4a89-88ea-beaaf53a606e.v1.png?odnHeight=16&odnWidth=16&odnBg=FFFFFF"
      ],
      "absolute top-0 left-0": [
        "https://i5.walmartimages.com/seo/VILINICE-Noise-Cancelling-Headphones-Wireless-Bluetooth-Over-Ear-Headphones-with-Microphone-Black-Q8_0cd6ae5a-8ea9-4e46-8b5e-fffb7da5e6f5.d4808578fda9397ec198b2d5dec46404.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/Bose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black_48e15895-cb0c-4a8a-b852-4c52dca7692a.5f403bdd71947a437bd6c8bafbb6b8d4.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/OneOdio-Wired-Over-Ear-Headphones-with-Mic-Noise-Cancelling-Earcups-Studio-DJ-Headphones-with-Dual-Ports-for-Computer-Black_c13f91b6-ba42-4546-8b06-0830d3344826.3edeff9f7ccba89981515bb979dea386.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/OneOdio-Wired-over-Ear-Headphones-with-Mic-Dual-Plugs-Deep-Bass-Sound-for-PC-Laptop-Phones-Red_115b65f9-b03e-4593-a0c5-202151b7dc9b.1f3fa720cc8320abf4871411fe6916e6.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/Mpow-Kids-Headphones-Microphone-Foldable-85-94dB-Volume-Limit-3D-Stereo-Adjustable-Headband-Soft-Earcups-Ear-Kids-Share-Function-Wired-School-Tablet_4272d222-af66-48b2-9c91-f6df41d7e657.653881036ddc688395cbf4ca0f474d5e.gif?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/JLab-Audio-JBuddies-Studio-On-ear-Kids-Folding-Headphones-with-Microphone-Volume-Safe-Gray-Blue-HJKSTUDIORGRYBLU6_ebb97b7a-3512-4dfa-8ca4-df7e3b97de13_1.1254787dc2ca28b7ddb470b5f06667a5.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/onn-Wired-on-Ear-Headphones-Black-New_098585ca-4559-42cb-a21e-0e19ea73ea1a.534b8976456996f2d587afb956762b38.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF",
        "https://i5.walmartimages.com/seo/Wireless-Earbuds-Bluetooth-5-0-Headphones-IPX8-Waterproof-Hight-Fidelity-Stereo-Sound-Quality-Ear-Headset-Built-in-Mic-LED-Charging-Case-21-Hours-Pla_017730d9-daca-40cf-96e0-21b61e33c0c5.55e1476d137a8795b33560016427e499.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF"
      ],
      "flex": ["//i5.walmartimages.com/dfw/63fd9f59-ac39/29c6759d-7f14-49fa-bd3a-b870eb4fb8fb/v1/wplus-icon-blue.svg"],
      "br-100 v-btm ba b--transparent": [
        "https://i5.walmartimages.com/asr/3381e5c8-b55b-42cc-b78f-323c64ce3047.9cd7fd2516bd6ca3c6d0a3da5834d986.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
        "https://i5.walmartimages.com/asr/7cbd2c20-c09a-449b-a323-8a154e5181e9.52dfbc37c15847a1f2b4579ed0ab9b79.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
        "https://i5.walmartimages.com/asr/98cd319b-0a96-41cb-89b7-7336031a3aad.08d842585156cf11fe7f697bd533402f.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
        "https://i5.walmartimages.com/asr/a6048703-eadb-4f5b-81f9-554979ca8a0a.69851709527ec9a0c40d26b00a2d86dd.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/e6b637bf-5b7d-4ed3-8f03-f8b9a359eae9.29b93e7be9bb463e51c9a66fca039304.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/8c92c76e-a960-4efc-ad51-fcb9c89b44e0.102c174d9416e33088381411ae684629.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/a088fd41-4f78-437f-ae18-bcf60fac4769.834d0a2a501f90b721ab373a0cbe3bd3.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/dbc9f833-9009-4e70-b9ae-a642796ad6bf.d7249fca19de34133a04ebc4f0e3ebd2.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/d8dfe380-dfbf-474d-a38b-1153dace5d21.70721549e4e32d92786c3bcf0a1b4582.png?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/754b2e4d-6f4a-437e-afb8-0c82eead22a9.14d10d8c6d6148284f7e56709ffe8077.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/017730d9-daca-40cf-96e0-21b61e33c0c5.55e1476d137a8795b33560016427e499.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
        "https://i5.walmartimages.com/asr/b4f59ae7-77ba-4b53-b23f-37f7e82975bd.1331b6c1773468e70657f0ee55a65ba8.jpeg?odnBg=FFFFFF&odnHeight=30&odnWidth=30",
        "https://i5.walmartimages.com/asr/4dcbe91c-b3e5-436a-8ac9-8f6c8df1e129.0db7b16a45b0e37dcb762ea92d03ebd1.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF",
        "https://i5.walmartimages.com/asr/c51a9ac3-b08d-4699-85b8-c007b032377e.36b30f8eb2ff68115ae27f63732725a8.jpeg?odnHeight=30&odnWidth=30&odnBg=FFFFFF"
      ],
      "mr1": ["//i5.walmartimages.com/dfwrs/76316474-f70e/k2-_67001355-c576-4ca2-989d-260a2673c41a.v1.png"],
      "no_class_found": [
        "https://www.walmart.com/akam/13/pixel_5bda523a?a=dD1jYmJiODcxZDVkMTM1ZGMwOThhMGUzMWRmN2U0NzJiZGM2YzBmYjExJmpzPW9mZg=="
      ]
    },
    "og_images": [
      "https://i5.walmartimages.com/seo/VILINICE-Noise-Cancelling-Headphones-Wireless-Bluetooth-Over-Ear-Headphones-with-Microphone-Black-Q8_0cd6ae5a-8ea9-4e46-8b5e-fffb7da5e6f5.d4808578fda9397ec198b2d5dec46404.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF"
    ],
    "links": [
      "https://www.walmart.com/search?q=headphones#maincontent",
      "https://www.walmart.com/all-departments",
      "https://www.walmart.com/",
      "https://www.walmart.com/my-items",
      "https://www.walmart.com/lists",
      "https://www.walmart.com/my-registries",
      "https://www.walmart.com/account/login?vid=oaoh",
      "https://www.walmart.com/orders",
      "https://www.walmart.com/plus",
      "https://wrd.walmart.com/track?bt=1&eventST=click&plmt=sb-search-top~desktop~&pos=1&tax=3944_133251_1095191_1230614_1230477&rdf=1&rd=https%3A%2F%2Fwww.walmart.com%2Fsearch%3Fq%3Dbose%26adsRedirect%3Dtrue&adUid=5df289f5-f006-403b-939e-25c482ed9e60&mloc=sb-search-top&pltfm=desktop&pgId=headphones&pt=search&spQs=B-0ORuQ6BMVYu5ErviP0wtXxvyXSkHVTZOp1e2rDjcoRq_MNG-D8nZwYzIobP0m5_yiNE5aJP_PLXBduk_CYa4p9PTneu01dzjWaRJ7SPKfKhvpYsvImGaJ2Zu5Cf4w4IuDlkyGfd0FDgUQ5GgOzYh_f6YuQzvl7abAVDMeVUmAwpChqoG563UdmA1A2NHTJcuxVjbLySLz2LWXuLEMcqg&storeId=1508&bkt=2482&addlInfo=~sbaItems%7C376188834%7C932544113~",
      "https://wrd.walmart.com/track?bt=1&eventST=click&plmt=sb-search-top~desktop~&pos=2&tax=3944_133251_1095191_1230614_1230477&rdf=1&rd=https%3A%2F%2Fwww.walmart.com%2Fip%2FBose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black%2F376188834%3FadsRedirect%3Dtrue&adUid=5df289f5-f006-403b-939e-25c482ed9e60&mloc=sb-search-top&pltfm=desktop&pgId=headphones&pt=search&spQs=m_0JyukHj9idXYjE3UJg90uFCO0g0V1jfID0Et9RKbOsSZ1bT7OkNFOcOuNYfwRZqOxiu2Ywg-IikpJTjRvHUmwt-UiDSwR25WxqpFDqMSDf1DSAFiDe8y_nm-vkLA-rBMY1NTIwA1AGa8DZwQPTNdo66B12BugtA8gyWCMGWeU-55AY9P5XbDlvIhJg5HqxwVqAOAAyRKmxBI_U3Ov-ew&storeId=1508&couponState=na&bkt=2482&/ip/Bose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black/376188834",
      "https://wrd.walmart.com/track?bt=1&eventST=click&plmt=sb-search-top~desktop~&pos=3&tax=3944_133251_1095191_1230614_1230477&rdf=1&rd=https%3A%2F%2Fwww.walmart.com%2Fip%2FBose-Noise-Cancelling-Headphones-700-over-ear-Wireless-Bluetooth-Earphones-Black%2F932544113%3FadsRedirect%3Dtrue&adUid=5df289f5-f006-403b-939e-25c482ed9e60&mloc=sb-search-top&pltfm=desktop&pgId=headphones&pt=search&spQs=*-AvGiXn44R9Lv4lomZqtEuFCO0g0V1jfID0Et9RKbOsSZ1bT7OkNFOcOuNYfwRZqOxiu2Ywg-IikpJTjRvHUmwt-UiDSwR25WxqpFDqMSDf1DSAFiDe8y_nm-vkLA-rBMY1NTIwA1AGa8DZwQPTNdo66B12BugtA8gyWCMGWeU-55AY9P5XbDlvIhJg5HqxwVqAOAAyRKmxBI_U3Ov-ew&storeId=1508&couponState=na&bkt=2482&/ip/Bose-Noise-Cancelling-Headphones-700-over-ear-Wireless-Bluetooth-Earphones-Black/932544113",
      "https://www.walmart.com/shop/deals/electronics/headphones-speakers-and-video",
      "https://www.walmart.com/browse/electronics/shop-all-headphones-by-type/3944_133251_1095191_1230614_4480?max_price=25&povid=ETS_Holiday_TAVC_nav_headphones_U25",
      "https://www.walmart.com/browse/electronics/shop-all-headphones-by-type/3944_133251_1095191_1230614_4480",
      "https://www.walmart.com/browse/electronics/apple-airpods/3944_133251_1095191_1231498_2452446",
      "https://www.walmart.com/browse/electronics/wireless-bluetooth-headphones/3944_133251_1095191_1230614_1230478",
      "https://www.walmart.com/browse/electronics/earbuds-in-ear-headphones/3944_133251_1095191_1230614_1230476",
      "https://www.walmart.com/browse/electronics/over-ear-on-ear-headphones/3944_133251_1095191_1230614_1230477",
      "https://www.walmart.com/browse/electronics/pc-gaming-headsets/3944_1089430_7052607_9433123_6790712",
      "https://www.walmart.com/browse/electronics/noise-cancelling-headphones/3944_133251_1095191_1230614_6051360",
      "https://www.walmart.com/browse/electronics/kids-headphones/3944_133251_1095191_1230614_1230480",
      "https://www.walmart.com/browse/electronics/sports-headphones/3944_133251_1095191_1230614_1231506",
      "https://www.walmart.com/browse/electronics/bone-conduction-headphones/3944_133251_1095191_1230614_4061824",
      "https://www.walmart.com/browse/electronics/true-wireless-headphones/3944_133251_1095191_1230614_8443225",
      "https://www.walmart.com/browse/electronics/waterproof-headphones/3944_133251_1095191_1230614_8436721",
      "https://wrd.walmart.com/track?bt=1&eventST=click&plmt=sp-search-middle~desktop~&pos=1&tax=3944_133251_1095191_1230614_1230477&rdf=1&rd=https%3A%2F%2Fwww.walmart.com%2Fip%2FVILINICE-Noise-Cancelling-Headphones-Wireless-Bluetooth-Over-Ear-Headphones-with-Microphone-Black-Q8%2F249420079%3Fathbdg%3DL1700%26adsRedirect%3Dtrue&adUid=5ca17ddb-5baf-436d-aba9-981903ec56fd&mloc=sp-search-middle&pltfm=desktop&pgId=headphones&pt=search&spQs=Q4PuPJiKTU0VgiILg4CCfmjYTVN_lI6VtLWozH0Iop2XJhVMOXyG7gISmZLPbmpGpEdtlfvKiY1G7WNHmRvvh6wJ9Tnw_77bUsdhYxKt1ka9rvxERUOLmosiXInaBp2QMQDiWKZOIqSNp8HSy1Y9EO2CLCh2-iDL0oHGt6jNTuHUbNQcqqoGglTuMh92vLyXZOVKVN7iZqSiPWzY2i5thOqeUkuzemiGjAkJEVPvpWU&storeId=1508&couponState=na&bkt=ace_3121%7Ccoldstart_off%7Csearch_default_tail_l1_disable_pop_boost&athbdg=L1700",
      "https://wrd.walmart.com/track?bt=1&eventST=click&plmt=sp-search-middle~desktop~&pos=2&tax=3944_133251_1095191_1230614_1230477&rdf=1&rd=https%3A%2F%2Fwww.walmart.com%2Fip%2FBose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black%2F376188834%3FadsRedirect%3Dtrue&adUid=5ca17ddb-5baf-436d-aba9-981903ec56fd&mloc=sp-search-middle&pltfm=desktop&pgId=headphones&pt=search&spQs=m_0JyukHj9idXYjE3UJg9zo21dErVbhfiNbjoM57ZCirOGaUNYFsDwTBc61YjFkkaHFRuLWpvz-0TRcaCX3xSTcwDnT_L0XfvyDTidG7UWCUNOTqcrUO0ceIpsonLt8NKmePQqCNgWHfEEnrtrs3Li5j1SjjNfuy7G1adbYCkzNbTJC01EpGw-nmu3i7Ep6wkWp_6oFq82PTlPU2rak16G7PsNtvbRQ5MfQ0hp5k7Gs&storeId=1508&couponState=na&bkt=ace_3121%7Ccoldstart_off%7Csearch_default_tail_l1_disable_pop_boost&/ip/Bose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black/376188834",
      "https://wrd.walmart.com/track?bt=1&eventST=click&plmt=sp-search-middle~desktop~&pos=3&tax=3944_133251_1095191_1230614_1230477&rdf=1&rd=https%3A%2F%2Fwww.walmart.com%2Fip%2FOneOdio-Wired-Over-Ear-Headphones-with-Mic-Noise-Cancelling-Earcups-Studio-DJ-Headphones-with-Dual-Ports-for-Computer-Black%2F950096760%3FadsRedirect%3Dtrue&adUid=5ca17ddb-5baf-436d-aba9-981903ec56fd&mloc=sp-search-middle&pltfm=desktop&pgId=headphones&pt=search&spQs=DfNEa7riVHRvPYwE7fB4yzDE4sFRdGlQfdI4D96J5iG0QVqxYCgvTBW0p_hlRv4BALEjQEAkdxu0YbLayUdGOoK-e4DxZzkTGV92xzubg1EQSyBbgfAkkffimBm_fkdcYAQlTOfkoAQQQEdDx2SEmxwhYGhpSLysRW6KsahKewHMxvq8Zau7QFlNxlBK-eeDOeIrvN5JbwLUzni13-4ZjuiMM8dvAuZe_c3nKyfG8eSfPmenhYOoknNnkqL5C5xjF3kwdWoY2rMgNk8hprU3Wg&storeId=1508&couponState=na&bkt=ace_3121%7Ccoldstart_off%7Csearch_default_tail_l1_disable_pop_boost&/ip/OneOdio-Wired-Over-Ear-Headphones-with-Mic-Noise-Cancelling-Earcups-Studio-DJ-Headphones-with-Dual-Ports-for-Computer-Black/950096760",
      "https://wrd.walmart.com/track?bt=1&eventST=click&plmt=sp-search-middle~desktop~&pos=4&tax=3944_133251_1095191_1230614_1230477&rdf=1&rd=https%3A%2F%2Fwww.walmart.com%2Fip%2FOneOdio-Wired-over-Ear-Headphones-with-Mic-Dual-Plugs-Deep-Bass-Sound-for-PC-Laptop-Phones-Red%2F970124388%3FadsRedirect%3Dtrue&adUid=5ca17ddb-5baf-436d-aba9-981903ec56fd&mloc=sp-search-middle&pltfm=desktop&pgId=headphones&pt=search&spQs=i_1k1IU1TnzEFRm0OorvmfVvGl2FlnToXCnQyCesMhXKkuwxjim5P77Fr_2x3eaG3qtHU_UhjGOq6fPayBPrpWiNIz0v09b2KXJMleLMy7GmZqcFLyAgYnJCS8E9xZlimoLki0mMRWzJ8hbAnskFWJkRCx3045ljZXr-_R3IN1bENFCZe4YjcfM9I3H8R0HkVou3_w1O7zcNkYR_bljlY5J3mITg_xivqsJYeFpsNJI&storeId=1508&couponState=na&bkt=ace_3121%7Ccoldstart_off%7Csearch_default_tail_l1_disable_pop_boost&/ip/OneOdio-Wired-over-Ear-Headphones-with-Mic-Dual-Plugs-Deep-Bass-Sound-for-PC-Laptop-Phones-Red/970124388",
      "https://www.walmart.com/ip/Mpow-Kids-Headphones-Microphone-Foldable-85-94dB-Volume-Limit-3D-Stereo-Adjustable-Headband-Soft-Earcups-Ear-Kids-Share-Function-Wired-School-Tablet/729302622?athbdg=L1600&from=/search",
      "https://www.walmart.com/ip/Mpow-Kids-Headphones-Microphone-Foldable-85-94dB-Volume-Limit-3D-Stereo-Adjustable-Headband-Soft-Earcups-Ear-Kids-Share-Function-Wired-School-Tablet/729302622?athbdg=L1600",
      "https://www.walmart.com/ip/MPOW-Kids-Headphones-Microphone-Stereo-Wired-85-94dB-Volume-Limit-Adjustable-Foldable-Children-Headphone-Share-Port-Ear-Headsets-School-Tablet-Airpla/573000754?variantFieldId=actual_color",
      "https://www.walmart.com/ip/Mpow-Kids-Headphones-School-Boys-Girls-Microphone-Safe-Volume-85-94dB-Foldable-Adjustable-Ear-Toddler-Earphones-Computer-Chromebook-Tablets-Sharing-J/723940737?variantFieldId=actual_color",
      "https://www.walmart.com/ip/MPOW-Kids-Headphones-Microphone-85-94dB-Volume-Limit-Hi-Fi-Stereo-Wired-Ear-Kids-Adjustable-Headband-Soft-Earcups-Audio-Share-Tangle-Free-Airplane/877864066?variantFieldId=actual_color",
      "https://www.walmart.com/ip/Mpow-Kids-Headphones-Microphone-Foldable-85-94dB-Volume-Limit-3D-Stereo-Adjustable-Headband-Soft-Earcups-Ear-Kids-Share-Function-Wired-School-Tablet/729302622?variantFieldId=actual_color",
      "https://www.walmart.com/ip/JLab-Audio-JBuddies-Studio-On-ear-Kids-Folding-Headphones-with-Microphone-Volume-Safe-Gray-Blue-HJKSTUDIORGRYBLU6/577015197?athbdg=L1600&from=/search",
      "https://www.walmart.com/ip/JLab-Audio-JBuddies-Studio-On-ear-Kids-Folding-Headphones-with-Microphone-Volume-Safe-Gray-Blue-HJKSTUDIORGRYBLU6/577015197?athbdg=L1600",
      "https://www.walmart.com/ip/JLab-Audio-JBuddies-Studio-Children-s-On-Ear-Headphones-Over-Ear-Headphones-Foldable-Graphite-Purple-JKSTUDIO-GRYPRPL-BOX/724645445?variantFieldId=actual_color",
      "https://www.walmart.com/ip/JLab-Audio-JBuddies-Studio-On-ear-Kids-Folding-Headphones-with-Microphone-Volume-Safe-Gray-Blue-HJKSTUDIORGRYBLU6/577015197?variantFieldId=actual_color",
      "https://www.walmart.com/ip/JLab-Audio-JBuddies-Studio-On-ear-Kids-Headphones-with-Microphone-Pink/1947609799?variantFieldId=actual_color",
      "https://www.walmart.com/ip/onn-Wired-on-Ear-Headphones-Black-New/948821441?from=/search",
      "https://www.walmart.com/ip/onn-Wired-on-Ear-Headphones-Black-New/948821441",
      "https://www.walmart.com/ip/onn-Wired-on-Ear-Headphones-Black-New/948821441?variantFieldId=actual_color",
      "https://www.walmart.com/ip/onn-Wired-On-ear-Headphones-Blue-New/803189432?variantFieldId=actual_color",
      "https://www.walmart.com/ip/onn-On-ear-Wired-Headphones-Pink-New/624074651?variantFieldId=actual_color",
      "https://www.walmart.com/ip/Wireless-Earbuds-Bluetooth-5-0-Headphones-IPX8-Waterproof-Hight-Fidelity-Stereo-Sound-Quality-Ear-Headset-Built-in-Mic-LED-Charging-Case-21-Hours-Pla/806859415?athbdg=L1800&from=/search",
      "https://www.walmart.com/ip/Wireless-Earbuds-Bluetooth-5-0-Headphones-IPX8-Waterproof-Hight-Fidelity-Stereo-Sound-Quality-Ear-Headset-Built-in-Mic-LED-Charging-Case-21-Hours-Pla/806859415?athbdg=L1800",
      "https://www.walmart.com/ip/Wireless-Earbuds-Bluetooth-5-0-Headphones-IPX8-Waterproof-Hight-Fidelity-Stereo-Sound-Quality-Ear-Headset-Built-in-Mic-LED-Charging-Case-21-Hours-Pla/806859415?variantFieldId=actual_color",
      "https://www.walmart.com/ip/Wireless-Earbuds-Bluetooth-Headphones-5-3-HiFi-Stereo-Earphones-4H-Playtime-Earbud-Earbud-Touch-Control-IPX4-Waterproof-Earphones-Sport-Headset-Andro/5039164278?variantFieldId=actual_color",
      "https://www.walmart.com/ip/VILINICE-Noise-Cancelling-Headphones-Wireless-Bluetooth-Over-Ear-Headphones-with-Microphone-Black-Q8/249420079?athbdg=L1700&from=/search",
      "https://www.walmart.com/ip/VILINICE-Noise-Cancelling-Headphones-Wireless-Bluetooth-Over-Ear-Headphones-with-Microphone-Black-Q8/249420079?athbdg=L1700",
      "https://www.walmart.com/ip/VILINICE-Noise-Cancelling-Headphones-Wireless-Bluetooth-Over-Ear-Headphones-with-Microphone-Black-Q8/249420079?variantFieldId=actual_color",
      "https://www.walmart.com/ip/VILINICE-Wireless-Bluetooth-Over-The-Ear-Headphones-with-Microphone-Active-Noise-Cancelling-Headphones-for-Travel-Sport/3737184614?variantFieldId=actual_color",
      "https://www.walmart.com/store/directory",
      "https://careers.walmart.com/",
      "https://corporate.walmart.com/",
      "https://marketplace.walmart.com/?utm_source=Walmart.com&utm_medium=link&utm_campaign=footer",
      "https://www.walmart.com/help",
      "https://www.walmart.com/cp/flu-shots-immunizations/1228302",
      "https://corporate.walmart.com/recalls",
      "https://www.walmart.com/help/article/responsible-disclosure-and-accessibility-policies/0f173dab8bd942da84b1cd7ab5ffc3cb",
      "https://www.walmart.com/taxexempt/",
      "https://walmart.onelink.me/UIev?pid=walmart.com&af_web_dp=https%3A%2F%2Fwww.walmart.com%2Fcp%2Fwalmart-mobile-app%2F1087865&c=Walmart.com%20Site%20Footer&af_dp=walmart%3A%2F%2F",
      "http://msds.walmartstores.com/",
      "https://www.walmart.com/help/article/walmart-com-terms-of-use/3b75080af40340d6bbd596f116fae5a0",
      "https://corporate.walmart.com/privacy-security",
      "https://corporate.walmart.com/california-transparency",
      "https://www.walmart.com/account/api/ccpa-intake?native=false&app=gm&type=sod",
      "https://corporate.walmart.com/privacy-security/california-privacy-rights#what-are-the-categories-of-personal-information-collected",
      "https://www.walmart.com/account/api/ccpa-intake?native=false&app=gm&type=access",
      "https://www.walmart.com/brand/branddirectory",
      "https://www.walmart.com/cp/walmart-in-the-know/7781927"
    ]
  }
}
```

### Extracting Walmart Sponsored Ads Data

In this example, we'll guide you on how to get walmart ppc ads data from the HTML content of a Walmart headphone search results page that you scraped earlier. This involves using two JavaScript libraries: cheerio, which is commonly used for web scraping, and fs, which is often used for working with the file system.

The JavaScript code below demonstrates how to use the Cheerio library to gather details about products from a Walmart best-seller page. It reads the HTML content from a "walmart-scraper.js" file, loads it into Cheerio, and extracts information such as product name, price, rating, reviews, and image URL. The script goes through each product container, saves the data in a JSON array.

```javascript
const fs = require('fs');
const cheerio = require('cheerio');

// Load the HTML content from the file
const htmlContent = fs.readFileSync('walmart-scraper.html', 'utf8');

// Load HTML content into cheerio
const $ = cheerio.load(htmlContent);

// Select all product containers (assuming they have the same class)
const productContainers = $('.sans-serif.mid-gray.relative.flex.flex-column.w-100.hide-child-opacity');

// Array to store information for all products
const products = [];

// Loop through each product container
productContainers.each((index, element) => {
  // Extract product information for each product
  const product = {};

  // Extract product type (Sponsored)
  const productTypeContainer = $(element).find('[data-testid^="variant-"] .gray');
  product.productType = productTypeContainer ? productTypeContainer.text().trim() : '';

  // Extract product name
  const productNameElement = $(element).find('[data-automation-id="product-title"]');
  product.name = productNameElement ? productNameElement.text().replace(/\s+/g, ' ').trim() : '';

  // Extract product price and currency symbol
  const productPriceContainer = $(element).find('[data-automation-id="product-price"]');

  // Extract the entire price string
  const priceString = productPriceContainer.find('.w_iUH7').text().trim();

  // Use a regular expression to separate currency symbol and numeric part
  const priceMatch = priceString.match(/([^\d]+)([\d,\.]+)/);

  if (priceMatch) {
    // Combine currency symbol and numeric part into one key: price
    // Remove the specific text "[Now]" from the price value
    product.price = `${priceMatch[1].trim()}${priceMatch[2]}`;
  } else {
    // Default value if there is no match
    product.price = '';
  }

  // Extract product rating and reviews
  const ratingContainer = $(element).find('.flex.items-center.mt2');
  const ratingText = ratingContainer.find('.w_iUH7').text().trim();

  // Extract only the rating without the number of reviews and reviews text
  const ratingWithoutReviews = ratingText.replace(/\d+\s*reviews/i, '').trim();
  product.rating = ratingWithoutReviews !== '' ? ratingWithoutReviews : 'Rating not available';

  // Extract only the numeric part of the reviews
  const reviewsMatch = ratingText.match(/(\d+)\s*reviews/i);
  product.reviews = reviewsMatch ? parseInt(reviewsMatch[1], 10) : 0;

  // Extract product image URL
  const imageUrlElement = $(element).find('img[data-testid="productTileImage"]');
  product.image = imageUrlElement ? imageUrlElement.attr('src') : '';

  // Add the product information to the array
  products.push(product);
});

// Create a JSON object with the extracted information for all products
const productsJson = JSON.stringify(products, null, 2);

// Print the JSON object to the console
console.log(productsJson);
```

**JSON Response:**

```json
[
  {
    "productType": "Sponsored",
    "name": "Bose QuietComfort 45 Headphones Noise Cancelling Over-Ear Wireless Bluetooth Earphones, Black",
    "price": "current price $329.00",
    "rating": "4.6 out of 5 Stars.",
    "reviews": 2238,
    "image": "https://i5.walmartimages.com/seo/Bose-QuietComfort-45-Headphones-Noise-Cancelling-Over-Ear-Wireless-Bluetooth-Earphones-Black_48e15895-cb0c-4a8a-b852-4c52dca7692a.5f403bdd71947a437bd6c8bafbb6b8d4.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF"
  },
  {
    "productType": "Sponsored",
    "name": "COWIN E7 Active Noise Cancelling Headphones Bluetooth Headphones with Mic Deep Bass Wireless Headphones Over Ear(Black)",
    "price": "current price $35.00",
    "rating": "4.5 out of 5 Stars.",
    "reviews": 1150,
    "image": "https://i5.walmartimages.com/seo/COWIN-E7-Active-Noise-Cancelling-Headphones-Bluetooth-Headphones-with-Mic-Deep-Bass-Wireless-Headphones-Over-Ear-Black_fc54e2c8-1164-4582-b0dc-1ed7dfe25a3b_1.ce7aa4a80aca56b2d1e59adfbc3ba438.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF"
  },
  {
    "productType": "Sponsored",
    "name": "OneOdio Wired Over-Ear Headphones with Mic | Noise Cancelling Earcups & Studio DJ Headphones with Dual Ports for Computer-Black",
    "price": "current price $31.99",
    "rating": "4.8 out of 5 Stars.",
    "reviews": 1952,
    "image": "https://i5.walmartimages.com/seo/OneOdio-Wired-Over-Ear-Headphones-with-Mic-Noise-Cancelling-Earcups-Studio-DJ-Headphones-with-Dual-Ports-for-Computer-Black_c13f91b6-ba42-4546-8b06-0830d3344826.3edeff9f7ccba89981515bb979dea386.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF"
  },
  {
    "productType": "Sponsored",
    "name": "Philips H4205 on-Ear Wireless Headphones with 32mm Drivers and BASS Boost on Demand, Black",
    "price": "current price $19.88",
    "rating": "4.3 out of 5 Stars.",
    "reviews": 23,
    "image": "https://i5.walmartimages.com/seo/Philips-H4205-on-Ear-Wireless-Headphones-with-32mm-Drivers-and-BASS-Boost-on-Demand-Black_b6de6dc8-4e04-48bb-97e0-a98444c39cc0.d274ce7ea7d072b4f4cf1cbb3c610a01.jpeg?odnHeight=784&odnWidth=580&odnBg=FFFFFF"
  }
]
```

### Ensuring Data Accuracy

Make sure the information you get from Walmart-Sponsored Ads is right is super important. Here, we'll talk about the best ways to make sure the data is accurate and some tricks to double-check.

**Best Practices for Reliable Extraction**

![Image description](https://crawlbase.com/blog/walmart-sponsored-ads-scraping/reliable-data-extraction.jpg)

- **Regular Data Validation:**
  Implement regular validation checks to ensure that the extracted data aligns with expected patterns. This involves verifying product details, pricing, and other relevant information against predefined criteria.

- **Robust Error Handling:**
  Develop robust error-handling mechanisms to address issues that may arise during the extraction process. This includes handling network errors, timeouts, and changes in website structure gracefully to prevent data inaccuracies.

- **Compliance with Terms of Service:**
  Adhere to Walmart's terms of service and guidelines for [data extraction](https://crawlbase.com/blog/guide-to-enterprise-data-extraction/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Guide to enterprise data extraction'). Ensure that your extraction methods comply with the platform's policies to avoid legal complications and disruptions to your data retrieval processes.

- **User-Agent Rotation:**
  Rotate user agents during web scraping to mimic human-like browsing behavior. This helps avoid detection and potential blocks from Walmart's security mechanisms, contributing to more reliable data extraction.

- **Throttling Requests:**
  Implement request throttling to control the rate of data extraction. Excessive requests within a short timeframe may trigger security measures on the Walmart platform, leading to temporary or permanent restrictions.

**Quality Assurance Techniques**

![Image description](https://crawlbase.com/blog/walmart-sponsored-ads-scraping/quality-assurance-techniques.jpg)

- **Comparative Analysis:**
  Conduct comparative analyses between the extracted data and a reliable reference source, such as manual checks or official product listings. Any discrepancies identified during this process should be investigated and addressed.

- **Automated Testing:**
  Develop automated testing scripts to validate the accuracy of the extracted data. These scripts can be designed to check data consistency, format adherence, and other critical parameters.

- **Cross-Verification:**
  Cross-verify data points with multiple extraction methods or sources to enhance reliability. Consistent information across different extraction approaches provides a higher level of confidence in the accuracy of the data.

- **Periodic Audits:**
  Conduct periodic audits of the extraction process to identify and rectify any emerging issues. Regular reviews help maintain the accuracy of the data over time, especially in the context of evolving website structures or data formats.

### Filtering and Organizing Data

It's really important to handle and arrange the information we get from Walmart-Sponsored Ads properly so that we can understand it better and make good decisions. In this part, we'll look at useful tips for organizing data well and talk about easy ways to filter the data to make analysis easier.

**Tips for Effective Data Organization**

1. **Structured Database Storage:**

[Store scraped data](https://crawlbase.com/blog/store-scraped-data-on-cloud/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Store scraped data') you gather in a structured database like SQL databases. This helps keep things organized and makes it easy to find what you need quickly. Put the data into tables with the right categories to make it simple to analyze later on.

2. **Timestamping:**

Add a time stamp to every data entry so that you can keep track of when the information was recorded. This helps in analyzing trends and changes over time, which is particularly useful when working with historical data.

3. **Categorization and Tagging:**

Organize products by their shared features and assign tags for easy recognition. This makes it easier to group and analyze products, helping to identify trends and understand product categories more clearly.

4. **Use of Unique Identifiers:**

Use special codes, like product IDs, to connect different sets of data. This helps make sure that when you combine or group data from different places, you do it accurately and avoid getting mixed up.

**Filtering Techniques for Analysis**
![Image description](https://crawlbase.com/blog/walmart-sponsored-ads-scraping/filtering-techniques-for-analysis.jpg)

1. **Price Range Filters:**

Sort products into different price ranges to see how well they're doing. This helps us figure out pricing trends and how we stack up against the competition.

2. **Performance Metrics Filters:**

Filter data based on ad performance metrics, such as CTR or conversion rates. This allows for the identification of high-performing products and areas for improvement in advertising strategies.

3. **Keyword-Based Filters:**

Create filters that use keywords to find and show products related to specific words or searches. This helps us understand what customers like and makes it easier for products to be seen.

4. **Promotional Text Filters:**

Utilize filters to categorize products based on promotional text or special offers. This helps evaluate the impact of promotions on product visibility and sales.

### Final Words

This guide gives you the information and tools to easily get Walmart Sponsored Ads data using JavaScript and the Crawlbase Crawling API. Whether you're new to web scraping or already know a bit, the ideas here give you a good start. If you want to try scraping on other online shopping sites like [Amazon](https://crawlbase.com/blog/scrape-amazon-data-for-buy-box-tracking/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Amazon'), [eBay](https://crawlbase.com/blog/how-to-scrape-ebay-using-javascript/ 'Scrape eBay'), or [AliExpress](https://crawlbase.com/blog/aliexpress-search-page-scraping/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape AliExpress'), [Airbnb](https://crawlbase.com/how-to-scrape-airbnb/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Airbnb') we have more guides for you to check out.

**Related guides:**

📜 [How to Scrape Amazon PPC Ad Data](https://crawlbase.com/blog/scrape-amazon-ppc-ads/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Amazon PPC Ad data')

📜 [How to Scrape Walmart Best Sellers](https://crawlbase.com/blog/scrape-walmart-best-sellers/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart best sellers')

📜 [How to Scrape Walmart Prices Easily](https://crawlbase.com/blog/how-scrape-walmart-prices-easily/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart prices')

📜 [Walmart Reviews Scraping Guide](https://crawlbase.com/blog/walmart-reviews-scraping-guide/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Walmart reviews scraping guide')

📜 [How to Scrape Walmart Search Pages](https://crawlbase.com/blog/scrape-walmart-search-with-python/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart search pages')

📜 [Scrape Walmart Product data with selenium Smart proxy](https://crawlbase.com/blog/scrape-walmart-product-page-with-selenium/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Scrape Walmart product data')

If you face problems or need more help, the [Crawlbase support team](https://crawlbase.com/contact-us/?utm_source=dev.to&utm_medium=referral&utm_campaign=content_distribution 'Crawlbase support team') is here for you. We want you to succeed in web scraping, and we're excited to help you along the way.

### Frequently Asked Questions

**How often should I extract updated Walmart ads data?**

To get the latest Walmart ads info, check a lot if the product prices or availability change a bunch. Keep an eye on special deals and check more if other businesses change their prices. Also, see when Walmart updates things and check around that time to be sure your info is right. It's important to find a good balance so you always have the newest info when making decisions.

**What are sponsored items on Walmart?**

Sponsored items on Walmart are products promoted by advertisers to gain increased visibility within search results or category pages. These items are strategically placed to capture shoppers' attention and drive more clicks. Advertisers pay for this premium placement, and sponsored products often feature a "Sponsored" label. These promotions are part of Walmart's advertising platform, allowing sellers to enhance their product visibility and reach a wider audience.

Sponsored items on Walmart can be different types of stuff, like electronics or things for your home. Advertisers use them to show off their products more to people looking around on Walmart. This makes it easier for advertisers to compete and focus on getting the attention of the right customers. The sponsored items stand out, and advertisers pay for this special promotion.

**How can I get Walmart-sponsored ads data?**

To get Walmart-sponsored ads data, you can try these methods:

1. Walmart API: Check if Walmart has an official way (like a special tool) to get sponsored ads data. This is usually the safest and approved way.
2. Third-Party Services: Look into other companies or tools that focus on collecting and sharing Walmart-sponsored ads data.
3. Web Scraping: Use web scraping to directly pull information from Walmart's website. Just make sure you're following their rules and the law.
4. Manual Extraction: You can also collect data by going through Walmart's website yourself and noting down the important info.

**Can I extract historical Walmart ads data?**

If you're looking for past Walmart ads, you might face challenges using their official API or other tools due to privacy and business reasons. But here are some simpler ways to explore:

1. **Archived Web Pages:** Check websites that save old versions of pages. They might have past Walmart ads.
2. **Regular Scraping:** If Walmart allows it, you can use a tool to regularly collect data from their site, creating a historical record.
3. **API Features:** If Walmart has an API, see if it lets you get older ad data. Some APIs have features for this.
4. **Third-Party Data Providers:** Look for companies that focus on historical e-commerce data. They might have what you need, including Walmart ads.

**What legal rules apply to extract Walmart ads data?**

When getting Walmart ads data, it's super important to follow the rules. Here's what to keep in mind:

1. **Terms of Service:** Read and understand Walmart's terms of use. They tell you what you can and can't do.
2. **Robots.txt:** Walmart uses a file called robots.txt. Follow the rules there to avoid legal trouble.
3. **Copyright:** Be mindful of copyright laws, especially when dealing with images, text, or any creative content associated with Walmart ads. Respect the intellectual property rights of Walmart and other content creators..
4. **Commercial Use:** If you're using the data for business, check if Walmart has any special rules or licenses you need.
5. **Scraping policies:** Some websites don’t allow web scraping in their terms of service. Respect these policies to avoid legal consequences.
6. **Data Protection Laws:** If you're dealing with personal info, think about data protection laws like GDPR(General Data Protection Regulation). Make sure you're following the rules.
7. **Country Laws:** Follow the laws of the country you're in. Different places have different rules about web scraping and data use.