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

@mrhansamala/youtube-toolkit

v1.0.1

Published

https://www.youtube.com Offical Api

Readme


📦 Installation

Global Install (dev mode)

git clone https://github.com/mrhansamala/youtube-toolkit.git
cd youtube-toolkit
npm install
npm link   # makes `youtube-toolkit` available globally

Uninstall:

npm unlink -g @mrhansamala/youtube-toolkit

⚙️ Setup API Keys

Go to Google Cloud Console .

Enable these APIs:

✅ YouTube Data API v3

✅ YouTube Analytics API

✅ YouTube Reporting API

Create OAuth2 credentials.

💻 Usage

🔎 1. Search Videos

@mrhansamala/youtube-toolkit --mode=search --q="cricket news" --max=5

✅ Sample Result

{
  "query": "cricket news",
  "mode": "api",
  "count": 5,
  "results": [
    {
       "videoId": "1ZYbU82GVz4",
      "url": "https://www.youtube.com/watch?v=1ZYbU82GVz4",
      "title": "Flying: Relaxing Sleep Music for Meditation, Stress Relief & Relaxation by Peder B. Helland",
      "channelId": "UCjzHeG1KWoonmf9d5KBvSiw",
      "channelTitle": "Soothing Relaxation",
      "publishedAt": "2016-07-03T17:09:48Z",
      "description": "Relaxing sleep music for deep sleeping and stress relief. Fall asleep to beautiful nature videos and use the relaxing music ...",
    }
  ]
}

📝 Full Result

 {
      "source": "api",
      "videoId": "1ZYbU82GVz4",
      "url": "https://www.youtube.com/watch?v=1ZYbU82GVz4",
      "title": "Flying: Relaxing Sleep Music for Meditation, Stress Relief & Relaxation by Peder B. Helland",
      "channelId": "UCjzHeG1KWoonmf9d5KBvSiw",
      "channelTitle": "Soothing Relaxation",
      "publishedAt": "2016-07-03T17:09:48Z",
      "description": "Relaxing sleep music for deep sleeping and stress relief. Fall asleep to beautiful nature videos and use the relaxing music ...",
      "thumbnails": {
        "default": {
          "url": "https://i.ytimg.com/vi/1ZYbU82GVz4/default.jpg",
          "width": 120,
          "height": 90
        },
        "medium": {
          "url": "https://i.ytimg.com/vi/1ZYbU82GVz4/mqdefault.jpg",
          "width": 320,
          "height": 180
        },
        "high": {
          "url": "https://i.ytimg.com/vi/1ZYbU82GVz4/hqdefault.jpg",
          "width": 480,
          "height": 360
        }
      }
    }
  ]
}

📊 2. Fetch Analytics

@mrhansamala/youtube-toolkit --mode=analytics --startDate=2025-08-01 --endDate=2025-09-01

✅ Sample Result

{
  "rows": [
    ["2025-08-01", "1000", "150", "25"],
    ["2025-08-02", "1200", "180", "40"]
  ],
  "columnHeaders": [
    { "name": "day" },
    { "name": "views" },
    { "name": "estimatedMinutesWatched" },
    { "name": "subscribersGained" }
  ]
}

📝 3. Download Reporting Jobs

@mrhansamala/youtube-toolkit --mode=reporting

✅ Sample Result

{
  "jobs": [
    {
      "id": "job-123456",
      "reportTypeId": "channel_basic_a2",
      "name": "Channel Basic Report"
    }
  ]
}

🛠️ Advanced Usage

Enable Debug Mode

@mrhansamala/youtube-toolkit --mode=search --q="sri lanka news" --debug

Pipe Results into jq

@mrhansamala/youtube-toolkit --mode=search --q="music mix" --max=3 | jq '.results[].title'

Export Analytics to CSV

@mrhansamala/youtube-toolkit --mode=analytics --startDate=2025-08-01 --endDate=2025-09-01 > analytics.json
jq -r '.rows[] | @csv' analytics.json > analytics.csv

📂 Project Structure

@mrhansamala/youtube-toolkit/
 ├─ index.js          # Main CLI entry
 ├─ package.json      # NPM config
 ├─ README.md         # Docs
 └─ token.json        # Auto-created after OAuth login

⚠️ Notes

API quota applies (10,000 units/day default).

Scraper mode (--mode=scrape) is fragile – may break any time.

Recommended: always use API mode.

👨‍💻 Owner

Made with ❤️ by mrhansamala MIT License © 2025