GithubHelp home page GithubHelp logo

daxidngyn / stockx-data Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 3.0 715 KB

Unofficial StockX API to scrape product info utilizing requests/promises

Home Page: https://www.npmjs.com/package/stockx-data

License: MIT License

JavaScript 100.00%
stockx sneakers api shoes

stockx-data's Introduction

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);
    });
  });
});

stockx-data's People

Contributors

daxidngyn avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.