youtube-restriction
v1.0.3
Published
Javascript wrapper to check if a YouTube video it's blocked somewhere around the world
Downloads
17
Maintainers
Readme
Let's check if your favorite YouTube videos are blocked in your country or someone else's country. This module uses the official Google API v3.
Download
npm install youtube-restriction
Usage
First, do a constructor with your API key. If you don't have API key, check this tutorial.
var restrictionHelper = require("youtube-restriction");
var youtubeRestriction = new restrictionHelper("apikey");
Functions
Those functions work with current available videos. It will return error if input it's a deleted video, private video or copyrighted video.
.checkFor(videoURL) Check if a YouTube video it's blocked for some countries, worldwide or not blocked. If the video it's blocked somewhere, it will return an array list with the countries affected. Otherwise it will return that the video it's available worldwide.
youtubeRestriction.checkFor('https://www.youtube.com/watch?v=fzQ6gRAEoy0').then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
});
.checkForSpecificCountry(videoURL, countryname) Check if a YouTube video it's blocked for the country you specify. If the video it's blocked there, it will return a true bool. Otherwise it will return a false bool. If the video is not blocked, it will return null. Make sure you specify the country name in English.
youtubeRestriction.checkForSpecificCountry('https://www.youtube.com/watch?v=fzQ6gRAEoy0', 'Japan').then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
});
License
MIT, check LICENSE file.