npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wb-private-api

v0.6.6

Published

Wildberries Private API

Downloads

78

Readme

GitHub package.json version GitHub last commit GitHub commit activity GitHub Workflow Status

npm

NodeJS модуль. Работает через приватное API Wildberries

Установка: npm i wb-private-api

После установки рекомендую протестировать работоспособность

image

Если все результаты положительные, значит библиотека полностью работоспособна и сервера WB отвечают верно. В случае, если каки-либо тесты отрицательные, прошу создать обращение https://github.com/glmn/wb-private-api/issues

Пример работы

Вывод данных о первом товаре из поисковой выдачи по ключевому слову

import { WBPrivateAPI, Constants } from "wb-private-api";

const keyword = "HotWheels";

/*
 * Select destination and init WBPrivateAPI with it
 * You can find more destionations in Constants.DESTINATIONS
 */
const destination = Constants.DESTINATIONS.MOSCOW;
const wbapi = new WBPrivateAPI({ destination });

const initiate = async () => {
  /*
   * Search and Grab first 2 pages
   * with specified keyword
   */
  const catalog = await wbapi.search(keyword, 2);
  const product = catalog.products[0];

  /*
   * Returning all Stocks with Warehouses Ids
   * Then you can compare these Ids
   * using Constants.WAREHOUSES
   */
  const stocks = await product.getStocks();

  /* No comments here :P */
  const feedbacks = await product.getFeedbacks();
  const questions = await product.getQuestions();
};

initiate();

Вывод рекламодателей из поисковой выдачи по ключевому слову

import { WBPrivateAPI, Constants } from "wb-private-api";

const keyword = "Менструальные чаши";

/*
 * Select destination and init WBPrivateAPI with it
 * You can find more destionations in Constants.DESTINATIONS
 */
const destination = Constants.DESTINATIONS.MOSCOW;
const wbapi = new WBPrivateAPI({ destination });

const initiate = async () => {
  /*
   * Search ads in search results
   * with specified keyword
   */
  const { pages, prioritySubjects, adverts } = await wbapi.getSearchAds(
    keyword
  );

  // Ads positions on each page
  console.log(pages);

  // Subjects ordered by priority
  console.log(prioritySubjects);

  // Adverts including CPM
  console.log(adverts);
};

initiate();

WBPrivateAPI методы

.search(keyword, pageCount, retries = 0, filters = []) - Поиск всех товаров по Ключевому слову keyword. pageCount отвечает за кол-во необходимых страниц для прохода. Если pageCount = 0, то будет взяты все страницы или 100, если их больше. retries отвечает за количество попыток выполнить запрос, если в ответ был получен статус 5хх или 429. filters это массив с объектами вида [{type: 'fbrand' value: 11399 }], необходим для фильтрации поисковой выдачи по брендам, поставщикам, цене и т.д. Метод возвращает объект WBCatalog

.getSearchAds(keyword) - Поиск рекламодателей (в разделе Поиск) по Ключевому слову

.getCarouselAds(keyword) - Поиск рекламодателей внутри карточке в каруселе "Рекламный блок"

.keyHint(query) - Возвращает список подсказок из поиска WB по фразе query

.searchSimilarByNm(productId) - Возвращает список похожих товаров (как в разделе "Похожие товары" внутри карточки на WB)

.getPromos() - Возвращает массив текущих промо-акций на WB

.getListOfProducts(productIds) - Возвращает массив найденных артикулов на WB с деталями (Не оборачивается в WBProduct)

WBCatalog методы

.page(number) - Возвращает массив товаров с заданной страницы (массив состоит из объектов WBProduct)

.getPosition(productId) - Возвращает номер позиции по заданному SKU. Если такого SKU в выдаче нет, то вернёт -1

WBProduct методы

.create(id) - Статичный метод. Использовать в виде WBProduct.create(id). Где id = Артикул товара. Метод асинхронный, поэтому перед вызовом используйте await. Вернет объект WBProduct

.totalStocks - Вернёт сумму остатков товара со всех складов (!) предварительно вызвать .getStocks())

.getStocks() - Присвоет (и вернет) свойству stocks массив с данными об остатках на складе

.getPromo() - Присвоет (и вернет) свойству promo объект с данными об участии в промо-акции

.getFeedbacks() - Присвоет (и вернет) свойству feedbacks массив со всеми отзывами WBFeedback о товаре

.getQuestions() - Присвоет (и вернет) свойству questions массив со всеми вопросами WBQuestion о товаре

WBFeedback методы

.getPhotos(size='min') - Вернет ссылки на все фотографии в текущем отзыве. size по умолчанию = min. Заменить на full если необходим большой размер