Giter VIP home page Giter VIP logo

node-netflix2's Introduction

netflix2

A client library to access the not-so-public Netflix Shakti API.

Installation

npm install netflix2

Usage

All functions take standard Node callbacks:

function callback (error, result) {}

Initialization

var Netflix = require('netflix2')
var netflix = new Netflix()

or

var netflix = require('netflix2')()

Login

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: '[email protected]',
  password: 'yourpassword'
}
netflix.login(credentials, callback)

Browse

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));
  }
})

Get Profiles

netflix.getProfiles(function (error, profiles) {
  profiles === [
    {"firstName":"Lana", "guid":"BLRHT3T5WVF5TLL6VDX2Z2NA2E", ...},
    {"firstName":"Danielle", "guid":"CPPS2FVBJVBNJPRKNBYHEWC524", ...},
    ...
  ]
})

Switch Profile

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)

Get Rating History

netflix.getRatingHistory(function (error, ratings) {
  ratings === [
    {"title":"Futurama","movieID":70153380,"yourRating":4.0, ...},
    {"title":"Super Troopers","movieID":60022689,"yourRating":4.0, ...},
    ...
  ]
})

Get Viewing History

netflix.getViewingHistory(function (error, result) {
  if(error){
    console.error(error);
  } else {
    console.log(JSON.stringify(result));
  }
})

Hide Viewing History

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 complete Viewing History

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));
  }
})

Set Video Rating

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)

Get Active Profile

netflix.getActiveProfile(function (error, result){
  if(error){
    console.error(error);
  } else {
    console.log(JSON.stringify(result));
  }
})

Get Avatar URL

console.log(netflix.getAvatarUrl(avatarName, size));

Set Avatar Name

netflix.setAvatar(avatarName, callback);

Warning

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.

node-netflix2's People

Contributors

cyberwitch avatar danielbeeke avatar dependabot[bot] avatar filipe-costa avatar genderquery avatar gnjack avatar greeny1997 avatar lbbo avatar lukedurrant avatar mickdekkers avatar orgicus avatar pcanas avatar sduduzog avatar wiiseguy 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.