renaldo:youtube-api

v0.0.1Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Youtube API

Installation

$ mrt add youtube-api

Documentation

You can find the docs for the API of this client at http://ionicabizau.github.io/youtube-api/

Additionally, the official Youtube documentation is a very useful resource.

Example (server-side)

1YoutubeApi.authenticate({
2    type: "oauth",
3    token: ACCESS_TOKEN
4});
5
6YoutubeApi.channels.list({
7    "part": "id",
8    "mySubscribers": true,
9    "maxResults": 50
10}, function (err, data) {
11    console.log(err, data);
12});

Search for videos

1YoutubeApi.authenticate({
2    type: 'key',
3    key: 'YOUR_KEY'
4});
5
6Meteor.methods({
7    searchVideo: function(search) {
8        YoutubeApi.search.list({
9            part: "id",
10            type: "video",
11            maxResults: 5,
12            q: search,
13        }, function (err, data) {
14            console.log(err, data);
15        });
16    }
17});

Authentication

1YoutubeApi.authenticate({
2    type: "oauth",
3    token: "your access token"
4});
5
6YoutubeApi.authenticate({
7    type: 'key',
8    key: 'YOUR_KEY'
9});

Implemented Youtube APIs

All APIs that don't require POST, PUT or DELETE request methods are supported. More features will be added in the next versions.

Running the Tests

Download and test this module using this test application.

Note that a connection to the internet is required to run the tests.

Contributors

See package.json file.

LICENSE

MIT license. See the LICENSE file for details.

Changelog

v0.2.2

  • Removed debugging message from index.js
  • Output an error in application logs if there is an unkwnown error in request
  • Minor fix in util.js

v0.2.1

v0.2.0

  • Added the key authentication.

    Example:

    1YoutubeApi.authenticate({
    2    type: 'key',
    3    key: 'AIz...OtE'
    4});

v0.1.1

  • Fixed #2 (pull request): fix in videos API requests.

v0.1.0

  • Initial release
  • Supports only GET requests