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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-youtube-video-fetcher

v1.0.81

Published

A simple npm package to fetch YouTube video information

Downloads

474

Readme

YouTube Data API Integration Script Overview

This script utilizes Node.js to interface with the YouTube Data API, providing functions to fetch video data, obtain channel IDs, and perform channel-specific video searches. In addition, The script tracks API usage and generates HTML markup from the fetched data.

Version : 1.0.8

Prerequisites

  • Node.js: download from Node.js official website.
  • YouTube Data API Key: create a project in the Google Developers Console, enable the YouTube Data API v3, and then generate an API key. The maximum request is 10,000 requests per day.

Setup (Git)

  • Clone or download script files.
  • Install dependencies running npm install in the script's directory via terminal or command prompt.
  • Create a `config.mjs' file in the script's directory and add the following code:
export function apiKey() {
    return 'YOUR_API_KEY';
}

Replace 'YOUR_API_KEY' with your YouTube Data API key.

Setup (Npm Package)

  • Install the package using npx node-youtube-video-fetcher-setup in your project directory.
  • Create a `config.mjs' file in the script's directory and add the following code:
export function apiKey() {
    return 'YOUR_API_KEY';
}
  • Replace 'YOUR_API_KEY' with your YouTube Data API key.
  • Run npx node-youtube-video-fetcher-setup to create the necessary files and directories.

Script Usage

Run the script using Node.js via terminal or command prompt:

  • node script.mjs

Inputs required:

  • API Key: enter your YouTube Data API key for required authentication.
  • Task: select the task ranging from fetching videos from a playlist (1), obtaining a channel ID (2), or performing a general channel search (3).
  • Depending on the task, enter additional information like Playlist ID, Channel Query, or Channel ID and Timeframe.
  • Choose the output format (JSON or CSV).
  • The script checks the quota usage and warns about potential quota violations.

Output

  • For tasks 1 and 3: a JSON or CSV file with the fetched video details is generated.
  • For task 2: the script outputs the channel ID on the terminal.

Generating and Viewing HTML

  • Open the project folder in an environment like Live Server, XAMPP, or MAMP.
  • Use tags like &title& and &link& in your HTML template. These will be replaced by actual data from the file.
  • Select JSON or CSV as source.
  • Use the “Copy code” button to copy the HTML output.
  • Preview the generated HTML output by clicking on the Results tab.

Important Notes

  • Be cautious of the YouTube Data API quota limits.
  • Keep your API key secure.
  • You will need to enter the API key each time you run the script. Unless you want to hardcode it, but keep in mind that for any future changes, you will need to edit the script.

Troubleshooting

  • For errors relating to quota or invalid parameters, check your API key and input parameters.
  • Ensure stable internet connection.
  • For unhandled exceptions, refer to the error messages in the terminal.

Support

For additional help or to report issues, please contact the script maintainer or developer.

  • Developer: JeremiahK

Links