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

ytjs

v1.1.0

Published

Youtube API v3 Universal Javascript Library for nodeJS, AMD and browser which provides easy API

Downloads

15

Readme

YTjs

Youtube API v3 Universal Javascript Library for nodeJS, AMD and browser which provides easy API

No Jquery needed.

How to get Youtube API Key

Click here

Node JS

Example

var youtube = require('ytjs')("API KEY");

youtube.getdata({ videoId: "TlgqWeuhJj4"},function(err, result){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(result);
});

Browser

include yt.js

<script type="text/javascript" src="yt.js" ></script>

Initalize the library and get Data

var youtube  = $youtube("API KEY");

 youtube.getdata({ videoId: "TlgqWeuhJj4" },function(err, result){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(result);
 });
        
youtube.getdata({ videoId: "PMr2NRPdpH4"}, function(err, result){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(result);
});

Methods Available

  1. getdata
  2. search
  3. getComments
  4. getRelatedVideos

get video data (getdata)

youtube.getdata({ videoId: "TlgqWeuhJj4" },function(err, result){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(result);
 });

Searching for Videos (search)

youtube.search({keyword: "rihanna love", fullResults: 1, order: "relevance"}, function(err, data){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(data);
});

Comments (getComments)

youtube.getComments({videoId: "PMr2NRPdpH4"}, function(err, data){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(data);
});   

Related videos (getRelatedVideos)

youtube.getRelatedVideos({videoId: "PMr2NRPdpH4"}, function(err, data){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(data);
});       

Options

getdata

  1. videoId : youtube video id
  2. part: "snippet,statistics,contentDetails" // you can pass either of three orcombination or all

output format (getdata)

You can get wide variety of data from getdata method and always youtube original data can be referred in raw

"title":
"description":
"rating":
"views":"",
"publishedAt":
"dthumbnail":
"mthumbnail":
"hthumbnail":
"sthumbnail":
"categoryId":
"channelTitle":
"videoId":"",
"duration":
"mins":
"hr":
"secs":
"dimension":
definition":
caption":
licensedContent":
"viewCount":
"likeCount":
"dislikeCount":
"favoriteCount":
"commentCount":
"kind":
"channelId":
"thumbnails":{}
"tags":{}
"liveBroadcastContent":"none"
"localized":{}
"projection":
"raw":{}

search

  1. keyword : keyword for search
  2. order: "relevance" // date, rating, viewCount, videoCount, title
  3. type : "basic" // "detailed" will provide additional information for each search video
  4. navigate : "next" // would render next set of results as youtube only allows 50 videos at a time

output format (search)

You can get wide variety of data from search method. Results of search will be returned in videos array and always youtube original data can be referred in raw

"videos" : []
nextPageToken:
prevPageToken:
kind:

comments

youtube.getComments({videoId: "PMr2NRPdpH4"}, function(err, data){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(data);
    nextComments();
});

// next set of comments
function nextComments() {
    youtube.getComments({videoId: "PMr2NRPdpH4", navigate: "next"}, function(err, data){
        if(err) {
          console.log(err);
          return false;
        }
        console.log(data);
    });
}

output format (getComments)

You can get wide variety of data from getComments method. Results of comments will be returned in items array and always youtube original data can be referred in raw

items array item usually have different values such as textDisplay, authorDisplayName, authorProfileImageUrl, likeCount etc

items : []
nextPageToken:
prevPageToken:
resultsPerPage:
raw:

Related videos (getRelatedVideos)

youtube.getRelatedVideos({videoId: "PMr2NRPdpH4"}, function(err, data){
    if(err) {
      console.log(err);
      return false;
    }
    console.log(data);
});    

output format (getRelatedVideos)

You can get wide variety of data from getRelatedVideos method. Results of related videos will be returned in videos array and always youtube original data can be referred in raw

"videos" : []
nextPageToken:
prevPageToken:
kind:

debug mode

Debug mode will print details to your console. you can enable debug mode during intialization by passing true

var youtube  = $youtube("API KEY", true);

Implemented Features

[ x ] get Video Data

[ x ] search for videos

[ x ] get Comments

[ x ] npm module

[ x ] related videos

Upcoming Plan

[ ] Please open an issue