Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yt-api

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yt-api

A light weight, easy, and super fast way of interacting with the YouTube Data API v3.

  • 0.1.3
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
2
Weekly downloads
 
Created
Source

Welcome to the yt-api a light weight, easy, and super fast way of interacting with the YouTube Data API v3.

Setup

To use the api you need a api key from google and you can get that here Once you have created the api key you need to enable the Youtube Data API v3 by clicking on the libraries tab and clicking on the Youtube Data API v3 then click on enable and your almost done!

Defining the api

const api = require("yt-api").api;
const API = new api("PASTE_API_KEY_HERE");

Getting video info

API.getVideoByID("mj9KRKSvdbk" /*This must be a valid video id or else it will reject the promise*/).then(i => {
    console.log("Here is the url: "+i.url);
}).catch(e => console.error(e));

//Returns Promise<VideoInfo>

Searching for a video

API.searchForVideo("H.A.Y ncs").then(i => {
    console.log("Here is the url: "+i.url);
}).catch(e => console.error(e));

//Returns Promise<SearchedVideoInfo>
/*NOTE: You can use the getVideoByID function to get more info about this video*/

Searching for multiple videos

API.searchForVideos("H.A.Y ncs").then(i => {
    console.log("Here is the first result's video url "+i[0].url)
}).catch(e => console.error(e));

//Returns Promise<SearchedVideoInfo> as a array

FAQs

Package last updated on 27 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc