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

youtube-scraper-api

v0.0.1

Published

Node.js client for the ScrapingBee YouTube API: search, video metadata, and subtitles as structured JSON.

Readme

youtube-scraper-api

Node.js client for the ScrapingBee YouTube scraper API. Search YouTube, read video metadata, and pull subtitles as parsed JSON, with proxies, headless rendering, and anti-bot handling done server-side. If you need a youtube scraping api in a Node service without running browsers yourself, this is the wrapper.

npm install youtube-scraper-api

Free tier: 1,000 credits, no card, at scrapingbee.com.

Build a YouTube scraper in three calls

A common flow: search a topic, pick a result, then enrich it with metadata and captions. Here it is end to end.

const { YouTubeScraper } = require('youtube-scraper-api');

const yt = new YouTubeScraper({ apiKey: 'YOUR-API-KEY' });

async function run() {
    const hits = await yt.search({ search: 'python tutorial', type: 'video', sortBy: 'view_count' });
    const videoId = hits.results[0].videoId;

    const details = await yt.metadata({ videoId });
    const captions = await yt.subtitles({ videoId, language: 'en' });

    console.log(details, captions);
}

run();

Every method returns a Promise that resolves to parsed JSON. Authentication is a Bearer token the client sets for you.

Each call on its own

Searching

const hits = await yt.search({ search: 'machine learning' });
console.log(hits.results);

A search is the core of any youtube video scraper: it returns videos, channels, and playlists with titles, view counts, durations, and thumbnails.

Metadata

const details = await yt.metadata({ videoId: 'dQw4w9WgXcQ' });

Returns duration, view count, like count, upload date, description, channel info, thumbnails, and available formats for one video.

Subtitles

const captions = await yt.subtitles({ videoId: 'dQw4w9WgXcQ', language: 'en' });

Returns timestamped caption segments. Pass subtitleOrigin to choose auto-generated or uploader-provided captions when both exist.

Search filters

Add any of these to a search() call:

| Option | API parameter | Accepted values | |---|---|---| | type | type | video, channel, playlist, movie | | uploadDate | upload_date | today, last_hour, this_week, this_month, this_year | | duration | duration | <4, 4-20, >20 | | sortBy | sort_by | rating, relevance, view_count, upload_date | | hd, fourK, subtitles, creativeCommons, live | hd, 4k, subtitles, creative_commons, live | booleans | | tag | tag | custom id echoed back in the response | | extra | (any) | object for other documented flags: 360, 3d, hdr, vr180, location, purchased |

const filtered = await yt.search({
    search: 'lo-fi',
    type: 'video',
    uploadDate: 'this_week',
    duration: '>20',
    live: true,
});

What a search returns

{
  "results": [
    {
      "videoId": "...",
      "title": { },
      "longBylineText": { },
      "thumbnail": { },
      "lengthText": { },
      "shortViewCountText": { },
      "publishedTimeText": { }
    }
  ],
  "search": "query string"
}

Each result carries only the fields YouTube returned, so guard with optional chaining before reading.

Credits and pricing

ScrapingBee bills successful calls. search() is 5 credits per call. The cost for metadata() and subtitles() shows in the dashboard request builder. Plan tiers: scrapingbee.com/pricing.

FAQ

Is there a free youtube scraper api?

ScrapingBee gives 1,000 free credits with no card. Search is 5 credits per call, enough for a few hundred test queries.

How do I get a transcript?

Call subtitles({ videoId }). It returns timestamped caption segments, and subtitleOrigin picks auto-generated or uploader-provided captions.

Why does a plain fetch return no video data?

YouTube renders results in the browser, so the raw HTML is empty. These endpoints run a headless browser server-side and return parsed JSON.

Is scraping YouTube allowed?

Public data is generally collectible for research and monitoring, but YouTube's terms and local regulations apply. Scrape public content only.

Links

License

MIT. See LICENSE.

Disclaimer

Unofficial Node.js wrapper around the ScrapingBee YouTube API. Not affiliated with ScrapingBee or YouTube. Compliance with YouTube's terms of service and applicable data-protection law is the responsibility of the operator.