Giter VIP home page Giter VIP logo

qm-yt-api's Introduction

logo-qm

qm-yt-api (DEPRECATED) npm version code style: prettier

Simple wrapper of youtube api for getting info about videos also ones in playlist.

Installation

$ npm i -S qm-yt-api

Usage

All module's functions returns promise object.

import ytAPI from "qm-yt-api";

// ...

const videoInfo = await ytAPI.getVideoInfo(key, videoId);
// =>
// {
//   id: "8CrOL-ydFMI",
//   title: "This Is Water ... "
// }

// or
const videos = await ytAPI.getVideosInfoFromPlaylist(key, playlistId);
// =>
// {
//   playlistName: "...",
//   playlistId: "PL14-...",
//   itemsNumber: 2,
//   askDate": "Tue Oct 31 2017 09:19:50 GMT+0100 (STD)",
//   videos: [
//     {
//       position: 0,
//       id: "8CrOL-ydFMI",
//       publishedAt: "2017-10-21T16:44:15.000Z",
//       title:
//         "This Is Water ..."
//     },
//     {
//       position: 1,
//       id: "RnGvWTRQ9j4",
//       publishedAt: "2017-10-21T16:44:59.000Z",
//       title: "Everyday Virtue..."
//     }
//   ],
// };

Options

There's possibility to get raw youtube api response. All you need is set additional option:

const options = { rawApiData: true }; //default: false
const videoInfo = await ytAPI.getVideoInfo(apiKey, videoId, options, apiOptions)

You can modify api request by passing apiOptions argument. Default used are:

const apiOptions = {
  part: "snippet, contentDetails"
};

See additional options in Google documentation.

YT API Errors:

For all encounter API error messages the module throws an error.

Tests

Tests are made against real YT data, so for performing testing you need working google apikey and put it to ./test/key.json file. Use .key-tmeplate.json as reference.

Limitations

Due to access via api key getting private video information is limitted.

Credits

License

MIT © qaraluch

qm-yt-api's People

Contributors

qaraluch avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.