A client library to access the not-so-public Netflix Shakti API.
npm install netflix2
All functions take standard Node callbacks:
function callback (error, result) {}
var Netflix = require('netflix2')
var netflix = new Netflix()
or
var netflix = require('netflix2')()
You must call login
before using any of the other below functions. This will set cookies, API endpoints, and the authURL that must used to make API calls.
var credentials = {
email: 'youremail@example.com'
password: 'yourpassword'
}
netflix.login(credentials, callback)
Browse movies: pass the genre (id), which page number (if more are available) and how many items per page to display along with the callback for the result.
/**
* Browse movies, to simply get all films use Category ID 34399
*
* @param genreId The Netflix Category ID, Like https://www.netflix.com/browse/genre/34399
* @param page The content is paged, this is the page number.
* @param perPage How many items do you want per page?
* @param callback Function to be called when the request is finished.
*/
netflix.browse(genreId, page, perPage, function (error, result) {
if(error){
console.error(error);
} else {
console.log(JSON.stringify(result));
}
})
netflix.getProfiles(function (error, profiles) {
profiles === [
{"firstName":"Lana", "guid":"BLRHT3T5WVF5TLL6VDX2Z2NA2E", ...},
{"firstName":"Danielle", "guid":"CPPS2FVBJVBNJPRKNBYHEWC524", ...},
...
]
})
Functions like getRatingHistory
and getRatingHistory
operate in the context of the current profile. Use switchProfile
to change the current profile. Find the profile GUID using getProfiles
above.
netflix.switchProfile(guid, callback)
netflix.getRatingHistory(function (error, ratings) {
ratings === [
{"title":"Futurama","movieID":70153380,"yourRating":4.0, ...},
{"title":"Super Troopers","movieID":60022689,"yourRating":4.0, ...},
...
]
})
netflix.getViewingHistory(function (error, result) {
if(error){
console.error(error);
} else {
console.log(JSON.stringify(result));
}
})
Hide a single episode / a movie or an entire series from viewing activity
// Hide single episode / movie
netflix.hideSingleEpisodeFromViewingHistory(movieID, function (error, result){
if(error){
console.error(error);
} else {
console.log(JSON.stringify(result));
}
})
// Hide entire series
netflix.hideEntireSeriesFromViewingHistory(movieID, function (error, result){
if(error){
console.error(error);
} else {
console.log(JSON.stringify(result));
}
})
Hide the complete viewing history. Note: this may not always reset the viewing history per series
/**
* Hides ALL viewing history: this may not always reset the viewing history per series (**no UNDO!**)
* use hideEntireSeriesFromViewingHistory passing the movieID to reset that series' history back
* to the first episode
*/
netflix.hideAllViewingHistory(function (error, result){
if(error){
console.error(error);
} else {
console.log(JSON.stringify(result));
}
})
On Netflix, users used to rate videos with stars. Then Netflix switched over to thumbs and now some users don't even know about the stars. You can set both types of ratings by using these two functions:
netflix.setStarRating(movieID, rating, callback)
netflix.setThumbRating(movieID, rating, callback)
netflix.getActiveProfile(function (error, result){
if(error){
console.error(error);
} else {
console.log(JSON.stringify(result));
}
})
console.log(netflix.getAvatarUrl(avatarName, size));
netflix.setAvatar(avatarName, callback);
Use of this software may constitute a breach in the Netflix Terms of Use and/or the End User License Agreement. Use at your own risk.