Youtube.getPlayCount()

Display the number of views of a Youtube Video.

Usage

Hover over inputs/exits for more info.

var Youtube = require('machinepack-youtube');


// Display the number of views of a Youtube Video.

Youtube.getPlayCount({

url: 'https://www.youtube.com/watch?v=TruIq5IxuiU',

apiKey: 'xAmBxAmBxAmBkjbyKkjbyKkjbyK',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// The rate limit has been exceeded.

rateLimitExceeded: function () {

 

},

// Unable to parse a video id from the provided YouTube URL.

invalidUrl: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

url required

The URL of a Youtube Video.

'https://www.youtube.com/watch?v=TruIq5IxuiU'
apiKey required

The private Google API key for this application.

'xAmBxAmBxAmBkjbyKkjbyKkjbyK'

Exits

error

An unexpected error occurred.

rateLimitExceeded

The rate limit has been exceeded.

invalidUrl

Unable to parse a video id from the provided YouTube URL.

success

OK.

{ viewCount: '19255096', likeCount: '116321' }