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

imot-bg-snapshot

v1.0.2

Published

Fetch a full snapshot of your imot.bg adverts via their Import API — paginated, with full details and images.

Readme

imot-bg-snapshot

Fetch a complete snapshot of your imot.bg adverts via their Import API — paginated, with full details (IDs) and images (filenames).

npm version License: MIT


What it does

Walks every page of your imot.bg account (/adverts/loadall), then loads the full details for each advert (/adverts/load) — including the complete picts image list. The result is saved as a single JSON file you can use for analysis, migration, or data matching.

Handles:

  • Automatic pagination (imot.bg returns the last page again instead of an empty one — this library detects and stops correctly)
  • Sale and Rent categories
  • Full image list per advert
  • Optional proxy support (needed on servers that can't reach api.imot.bg directly)
  • Polite request delay to stay within API limits

Requirements


Installation

npm install imot-bg-snapshot
# or for one-off CLI use:
npx imot-bg-snapshot --help

CLI usage

[email protected] \
IMOT_BG_PASSWORD=yourpassword \
npx imot-bg-snapshot --pretty --output snapshot.json

Or create a .env file in your working directory:

[email protected]
IMOT_BG_PASSWORD=yourpassword
# Optional proxy (if your server can't reach api.imot.bg directly):
# IMOT_BG_PROXY_URL=http://proxy-host:8000
# IMOT_BG_PROXY_AUTH=user:pass

Then just run:

npx imot-bg-snapshot --pretty

Options

| Flag | Default | Description | |---|---|---| | --output, -o | imot-bg-snapshot.json | Output file path | | --limit, -l | 0 (all) | Fetch only first N adverts (useful for testing) | | --delay, -d | 250 | Milliseconds between API requests |

Categories fetched by default: all six — Продажба (1), Наем (2), Купува (3), Търси да наеме (4), Заменя (5), Съквартиранти (6). Pass categories: [1, 2] to restrict. | --pretty | off | Pretty-print JSON output | | --help, -h | — | Show help |


Programmatic API

import { fetchImotBgSnapshot } from "imot-bg-snapshot";

const snapshot = await fetchImotBgSnapshot({
  username: process.env.IMOT_BG_USERNAME!,
  password: process.env.IMOT_BG_PASSWORD!,
  // proxyUrl: "http://proxy-host:8000",  // optional
  // limit: 10,                           // optional, 0 = all
  // delay: 250,                          // ms between requests
  // categories: [1, 2, 3, 4, 5, 6],       // default: all — see ImotBgConfig for full list
});

console.log(`Fetched ${snapshot.totalAdverts} adverts`);

for (const advert of snapshot.adverts) {
  console.log(advert.ida, advert.title, `${advert.picts.length} images`);
}

Lower-level functions

import { login, fetchAdvertsPage, fetchAdvertDetail } from "imot-bg-snapshot";

const token = await login(username, password);
const page1 = await fetchAdvertsPage(token, 1 /* pn */, 1 /* page */);
const detail = await fetchAdvertDetail(token, "{IDS}");

Output shape

{
  "fetchedAt": "2026-03-14T10:00:00.000Z",
  "totalAdverts": 451,
  "adverts": [
    {
      "ida": "{IDS}",
      "code": "CODE",
      "pubtime": "1754341860",
      "rub": "1",
      "type_home": "1",
      "price": "83573",
      "town": "4",
      "craion": "577",
      "praion": "",
      "area": "51",
      "extinfo": "Описание на имота...",
      "extri": ["53"],
      "picts": [
        { "file": "{IDS}_ow.jpg" },
        { "file": "{IDS}_qM.jpg" }
      ],
      "title": "TITLE_HERE",
      "pict": "//cdn3.focus.bg/imot/photosimotbg/1/465/big/{IDS}_ow.jpg"
    }
  ]
}

Note on picts: Only images uploaded via the API (pubpictslinks) appear with .pic extensions. Images uploaded through the imot.bg web UI appear as .jpg files. Both are normalised to bare filenames in the output.


TypeScript types

All types are exported from the package:

import type {
  ImotBgConfig,
  ImotBgSnapshot,
  ImotBgAdvert,
  ImotBgPicture,
  FetchProgress,
} from "imot-bg-snapshot";

License

MIT