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

viewstats-api

v0.1.0

Published

Unofficial viewstats API wrapper for Nodejs and Deno.

Readme

viewstats-api

viewstats-api is an unofficial wrapper for the ViewStats API, designed to work with both Node.js and Deno. It provides easy-to-use methods to interact with ViewStats, retrieve channel data, and perform advanced searches.

Features

  • Retrieve channel statistics, averages, and rankings
  • Fetch featured videos and popular channels
  • Advanced search capabilities for YouTube channels

Installation

Node.js

Install the package via npm:

npm install viewstats-api

Deno

Import the package from your repository URL:

import { ViewStatsAPI } from "https://github.com/Miguelo981/viewstats-api/mod.ts";

API Key

To use the viewstats-api, you'll need to obtain an API key. This can be done by inspecting the network requests in your browser.

Steps to get your API Key:

  1. Open your browser and navigate to the ViewStats website.
  2. Open the Developer Tools (usually by pressing F12 or Ctrl+Shift+I).
  3. Go to the Network tab and perform any action that makes a request to the ViewStats API (e.g., searching for a channel).
  4. Look for the request in the Network tab and select it.
  5. Under the Headers section, find the Authorization header.
  6. Copy the value of the Bearer token. This is your API key.

Usage

Basic Example

import { ViewStatsAPI } from "viewstats-api";

const apiToken = "your_api_token";
const api = new ViewStatsAPI(apiToken);

// Retrieve channel data by ID
const channel = await api.getChannel("mrbeast");

API Methods

| Method | Description | |--------|-------------| | getChannel(channelId: string): Promise<ChannelResponse> | Fetch channel details by channel ID. | | getChannelStats(channelId: string, params: ChannelStatsParams): Promise<ChannelStatsResponse[]> | Retrieve detailed statistics for a channel, including views, subscribers, and video counts. | | getChannelAverage(channelId: string): Promise<ChannelAverageResponse> | Get average stats such as views and estimated revenue over a period of time. | | getChannelLongAndShort(channelId: string): Promise<ChannelLongAndShortResponse> | Retrieve long and short video statistics for a channel. | | getChannelFeaturedVideo(channelId: string): Promise<ChannelFeaturedVideoResponse> | Fetch the featured video of a channel. | | advancedChannelSearch(params: ChannelAdvancedSearchParams): Promise<ChannelAdvancedSearchResponse> | Perform an advanced search for channels based on specific criteria. | | getRankingChannels(params: RankingChannelsParams): Promise<ChannelRankingResponse[]> | Fetch the rankings of channels based on subscribers or views. | | getPopularChannels(length: number = 10): Promise<PopularChannelsResponse[]> | Retrieve a list of popular channels. |

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Feel free to open issues and pull requests on the GitHub repository.