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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ytsearch.js

v2.1.0

Published

A lightweight YouTube search wrapper for Node.js and TypeScript with support for videos, playlists, and channels.

Readme

ytsearch.js

NPM Version NPM Downloads NPM Install Size NPM License NPM Release Date NPM Type Definitions Run Jest Tests Node.js Package

🔎 A powerful yet lightweight YouTube search wrapper for Node.js. Fetch videos, channels, playlists, movies, and live streams effortlessly without using the official API. Supports advanced playlist pagination with customizable user page limits, detailed video metadata fetching, sortable search results, combined multi-type search (via any), and comprehensive error handling — all via a clean, developer-friendly API.


🚀 Installation

npm install ytsearch.js

Requires Node.js v14+ (ESM supported).


📦 Usage

CommonJS

const { searchYouTube } = require("ytsearch.js");

(async () => {
  const results = await searchYouTube("Black Panther", {
    type: "video",
    limit: 10,
  });
  results.videos.forEach((item) => console.log(item.type, item.title));
})();

ES Modules

import { searchYouTube } from "ytsearch.js";

const results = await searchYouTube("Black Panther", {
  type: "channel",
  limit: 10,
});
results.channels.forEach((item) => console.log(item.type, item.title));

📑 Documentation

Full API documentation, examples, and error handling are available on the GitHub Wiki.


📑 API

searchYouTube

searchYouTube(query: string, options?: SearchOptions): Promise<SearchResult>;

Search Options

interface SearchOptions {
  type?: "video" | "channel" | "playlist" | "movie" | "live" | "any";
  sort?: "relevance" | "upload_date" | "view_count" | "rating";
  limit?: number; // 10–50 (default: 20)
}

Result

interface SearchResult {
  videos: VideoResult[];
  channels: ChannelResult[];
  playlists: PlaylistResult[];
  movies: VideoResult[];
  lives: VideoResult[];
  metadata: SearchMetadata;
  nextPage: () => Promise<SearchResult | null>;
}
  • If type is specific (video, channel, etc.), only that array will be filled.
  • If type is any, results include videos, channels, and playlists. (movies and lives are grouped under videos).

✅ Page size is limited to 10–50 to prevent excessive YouTube requests. Requests are buffered intelligently — YouTube is queried only when needed.


getPlaylistItems

Fetch a playlist with videos and pagination support.

getPlaylistItems(playlistId: string, options?: PlaylistOptions): Promise<PlaylistDetailsResult>;

Playlist Options

interface PlaylistOptions {
  limit?: number; // 10–100 (default: 50)
}

PlaylistDetailsResult Object

interface PlaylistDetailsResult {
  playlist: PlaylistInfo;
  videos: PlaylistVideo[];
  metadata: PlaylistMetadata;
  nextPage: () => Promise<PlaylistDetailsResult | null>;
}

Metadata includes YouTube page tracking, user page size, and total video count.


getVideoDetails

Fetch detailed metadata for a specific video by video ID.

getVideoDetails(videoID: string): Promise<VideoDetailsResult>;

🤝 Contributing

  1. Fork this repo
  2. Create a feature branch (git checkout -b feature/awesome)
  3. Commit changes (git commit -m 'Add awesome feature')
  4. Push branch (git push origin feature/awesome)
  5. Create a Pull Request 🚀

📜 License

MIT © 2025 RJRYT