Skip to content

Unofficial StockX API to scrape product info utilizing requests/promises

License

Notifications You must be signed in to change notification settings

daxidngyn/stockx-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StockX-Data

Unofficial StockX API to obtain product data through requests/promises.

Created by @daxidngyn. No longer being maintained as of June 18, 2022 but feel free to fork!

Searching for products

The searchProducts method simulates StockX's own search feature. This method takes in one parameter, the query, and returns an array of up to 20 product objects.

const StockXData = require("stockx-data");
const stockX = new StockXData();

stockX.searchProducts("Jordan 1 Clay Green").then((searchedProduct) => {
  console.log(searchedProduct)
});

Fetching product details

The fetchProductDetails method takes in one parameter, which can be a searched product, or a product's uuid/searchKey. Both the uuid and searchKey are included as part of a product's keys. This method returns additional data that is not provided when using the searchProducts method listed above, such as pricing data and a sizeMap, which maps sizes with their respective uuids (if the product is a parent). The returned sizeMap can then be utilized to obtain data about a specific product's specific size by calling this method again.

const StockXData = require("stockx-data");
const stockX = new StockXData();

stockX.searchProducts("Jordan 1 Clay Green").then((searchedProduct) => {
  //product as a parameter
  stockX.fetchProductDetails(searchedProduct[0]).then((productDetails) => {
    console.log(productDetails);
  });

  //uuid as a parameter
  stockX.fetchProductDetails(searchedProduct[0].uuid).then((productDetails) => {
    console.log(productDetails);
  });

  //seachKey as a parameter
  stockX.fetchProductDetails(searchedProduct[0].searchKey).then((productDetails) => {
    console.log(productDetails);
  });
  
  //obtaining data specific to size 10s
  stockX.fetchProductDetails(searchedProduct[0]).then((productDetails) => {
    stockX.fetchProductDetails(productDetails.sizeMap['10']).then((productDetails2) => {
      console.log(productDetails2);
    });
  });
});

About

Unofficial StockX API to scrape product info utilizing requests/promises

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published