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

get-youtube-video-info

v1.4.0

Published

Get your YouTube video info instantly.

Downloads

50

Readme

Youtube Video Info

The easiest way to instantly know your youtube video info.

🦀 Example Usage

const { getInfo, getStatistics, getDuration } = require("get-youtube-video-info");

(async () => {
const videoId = ""
const apiKey = ""

const info = await getInfo({ videoId: videoId, apiKey: apiKey })
const stat = await getStatistics({ videoId: videoId, apiKey: apiKey })
const duration = await getDuration({ videoId: videoId, apiKey: apiKey })
try {
console.log(`
  Video Infos:
  title: ${info.title}, publishedAt: ${info.publishedAt}, channelId: ${info.channelId}, description: ${info.description}, thumbnails: ${info.thumbnails.maxres.url}, channelTitle: ${info.channelTitle}

  Video Statistics:
  viewCount: ${stat.viewCount}, likeCount: ${stat.likeCount}, favoriteCount: ${stat.favoriteCount}, commentCount: ${stat.commentCount}

  Video Duration:
  duration: ${duration}
`)
} catch {console.error}
})();

Result

{
 info: {
  title: '{video title}',
  publishedAt: '{video publishedAt}',
  channelId: '{video channelId}',
  description: '{video description}',
  thumbnails.(object).url: '{video (object) thumbnail}' => Objects: [ default, medium, high, standard, maxres ],
  channelTitle: '{video channelTitle}'
 },
 stat: {
  viewCount: '{video viewCount}',
  likeCount: '{video likeCount}',
  favoriteCount: '{video favoriteCount}',
  commentCount: '{video commentCount}'
 },
 duration: '{video duration}'
}

Get API Key

  1. Sign in to Google Developer Console:

    • Log in to Google Developer Console to generate your YouTube API key. If you don't have a Google account, create one.
  2. Create a New Project:

    • Click on "Create Project" button at the top left corner of Developer Console to create a new project. You can name the project as you like.
  3. Enable the API:

    • Go to "APIs & Services" section from the left-hand menu.
    • Select "Library" under "APIs & Services".
    • Type "YouTube Data API v3" in the search bar and display the results.
    • Click on "Enable" button to activate the API.
  4. Generate Key:

    • Navigate to "Credentials" section from the left-hand menu.
    • Go to "API Keys" tab and click on "Create Credentials" button.
    • You'll have the option to name your key and set API restrictions if necessary. Set the restrictions if needed and click on "Create" button.
  5. Copy Your Key:

    • Once your key is created, you'll be provided with an API key. Copy this key.
  6. Use Your Key:

    • Use your API key to make calls to the YouTube API in your application or service. Integrate your API key in appropriate places and start using it.

Note: Keep your API key secure and avoid sharing it publicly. Your key can be misused by malicious individuals. Also, read the API usage limits and policies carefully, and implement them appropriately.

🐞 I found a bug!

📱 If you want to reach me, you can reach me via Discord!