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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rrrublev/wb-private-api

v0.8.6

Published

Node.js wrapper for Wildberries private API

Downloads

272

Readme

@rrrublev/wb-private-api

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

GitHub package.json version npm GitHub last commit GitHub commit activity

NPM

Установка

npm i @rrrublev/wb-private-api

Получение токена

Библиотека использует внутреннее API Wildberries, для доступа к которому требуется токен x_wbaas_token. Авторизация на сайте не нужна.

Как получить:

  1. Откройте wildberries.ru в браузере, дождитесь полной загрузки страницы
  2. Откройте DevTools (F12) → вкладка Console
  3. Вставьте и выполните содержимое файла scripts/get-wb-token.js
  4. Скопируйте выведенную строку JSON и сохраните в файл .wbaas_token в корне проекта

Токен действителен ~14 дней. По истечении повторите процедуру.

Использование токена в коде:

// Вариант 1 — файл .wbaas_token подхватывается автоматически
const wbapi = new WBPrivateAPI({ destination: Constants.DESTINATIONS.MOSCOW });

// Вариант 2 — передать токен явно
const wbapi = new WBPrivateAPI({
  destination: Constants.DESTINATIONS.MOSCOW,
  wbaasToken: "ВАШ_ТОКЕН"
});

// Вариант 3 — установить после создания
wbapi.setToken("ВАШ_ТОКЕН");

Примеры

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

const destination = Constants.DESTINATIONS.MOSCOW;
const wbapi = new WBPrivateAPI({ destination });

const catalog = await wbapi.search("HotWheels", 2);
const product = catalog.products[0];

const stocks = await product.getStocks();
const feedbacks = await product.getFeedbacks();
const { items: questions } = await product.getQuestions();
import { WBPrivateAPI, Constants } from "@rrrublev/wb-private-api";

const wbapi = new WBPrivateAPI({ destination: Constants.DESTINATIONS.MOSCOW });
const supplierId = 845298;

const total = await wbapi.getSupplierProductCount(supplierId);
console.log(`Всего товаров: ${total}`);

// pageCount = 0 — все страницы (до 100), pageCount = 3 — только первые 3
const catalog = await wbapi.getSupplierCatalogAll(supplierId, 3);

console.log(`Получено: ${catalog.products.length}`);
console.log(`Страниц: ${catalog.pages}`);

API

WBPrivateAPI

new WBPrivateAPI({ destination, wbaasToken? })

| Параметр | Тип | Описание | |----------|-----|----------| | destination | object | Направление доставки из Constants.DESTINATIONS | | wbaasToken | string | Токен. Если не передан — читается из .wbaas_token |

Поиск

| Метод | Возвращает | Описание | |-------|-----------|----------| | search(keyword, pageCount?, retries?, filters?) | WBCatalog | Поиск товаров по ключевому слову. pageCount = 0 — все страницы (до 100) | | keyHint(query) | array | Поисковые подсказки WB | | searchSimilarByNm(productId) | object | Похожие товары (как в разделе «Похожие товары» на WB) |

Товары

| Метод | Возвращает | Описание | |-------|-----------|----------| | getListOfProducts(productIds) | array | Данные по массиву артикулов | | getDeliveryDataByNms(productIds, retries?) | array | Данные о доставке по массиву артикулов | | getPromos() | array | Текущие промо-акции на WB |

Поставщики

| Метод | Возвращает | Описание | |-------|-----------|----------| | getSupplierInfo(sellerId) | object | Информация о поставщике | | getSupplierShipment(sellerId) | object | Данные об отгрузке поставщика | | getSupplierProductCount(supplierId) | number | Общее количество товаров поставщика | | getSupplierCatalogAll(supplierId, pageCount?, retries?) | WBCatalog | Все товары поставщика с постраничным перебором | | getSupplierCatalogPage(supplierId, page?, retries?) | array | Товары поставщика с указанной страницы |

Бренды

| Метод | Возвращает | Описание | |-------|-----------|----------| | getBrandProductCount(brandId) | number | Общее количество товаров бренда | | getBrandCatalogPage(brandId, page?, retries?) | array | Товары бренда с указанной страницы |

Токен

| Метод | Описание | |-------|----------| | setToken(token) | Устанавливает токен x_wbaas_token |


WBCatalog

Объект, возвращаемый методами search() и getSupplierCatalogAll().

Свойства

| Свойство | Тип | Описание | |----------|-----|----------| | products | WBProduct[] | Массив товаров | | pages | number | Количество страниц | | totalProducts | number | Общее количество товаров в выдаче |

Методы

| Метод | Возвращает | Описание | |-------|-----------|----------| | page(number) | WBProduct[] | Товары с заданной страницы (нумерация с 1) | | getPosition(productId) | number | Позиция товара по артикулу. -1 если не найден |


WBProduct

Создание

// Из поисковой выдачи — WBProduct создаётся автоматически внутри WBCatalog
const product = catalog.products[0];

// По артикулу напрямую
const product = await WBProduct.create(12345678);

Свойства

| Свойство | Тип | Описание | |----------|-----|----------| | totalStocks | number | Суммарный остаток по всем складам (требует предварительного вызова getStocks()) | | currentPrice | number | Текущая цена товара |

Методы

| Метод | Возвращает | Описание | |-------|-----------|----------| | getStocks() | array | Остатки на складах | | getPromo() | object | Участие в промо-акции | | getFeedbacks() | WBFeedback[] | Все отзывы о товаре | | getQuestions() | object | Все вопросы о товаре. Возвращает { items, totalQuestions, fetchedQuestions, truncated } | | getVideo(quality?) | object | Видео товара. quality по умолчанию "1440p". Возвращает { hasVideo, playlistUrl, hls, mp4Preview, duration, chunks } |


WBFeedback

| Метод | Возвращает | Описание | |-------|-----------|----------| | getPhotos(size?) | string[] | Ссылки на фото в отзыве. size: "min" (по умолчанию) или "full" |

Credits

Based on glmn/wb-private-api by Stanislav Gelman.
Licensed under ISC.