Giter VIP home page Giter VIP logo

rotten-reviews's Introduction

rotten-reviews

Scrape audience reviews from Rotten Tomatoes ๐Ÿ…

rotten-reviews

Description

This Node.js package scrapes Rotten Tomatoes audience reviews pages and scrapes the contents by getting the reviewer name, date, total stars, and review excerpt.

Future features are listed on the roadmap.

Requirements

  • Node.js

Usage

Running from binaries or global install

All binaries are compiled using pkg using Node.js v8.12.0. See the releases page for the binaries' download links. rotten-reviews can also be installed using npm or yarn globally by running:

# install using npm
npm -g i rotten-reviews

# install using yarn
yarn global add rotten-reviews
$ rotten-reviews
Usage: rotten-reviews [options] <title> <count>

Scrapes audience movie or tv show reviews from rotten tomatoes

Examples:
  rotten-reviews venom_2018 100
  rotten-reviews venom_2018 100 --csv
  rotten-reviews doctor_who/s11 10 --tv   (include the season # for tv shows)

Options:
  --csv       exports to csv (defaults to json)
  --tv        search as a tv show (defaults to movie)
  -h, --help  output usage information

Here's an example for scraping two Venom (2018) reviews:

$ rotten-reviews venom_2018 2
[
  {
    "reviewer": "Melissa B",
    "date": "October 11, 2018",
    "stars": 5,
    "review": "I loved it! Didn't expect to like it as much as I did.Some really funny parts and amazing action scenes. Ignore the critics, go see it!"
  },
  ...
]

Running from package

  • Install package by running:

    # install using npm
    npm i rotten-reviews
    
    # install using yarn
    yarn add rotten-reviews
  • Example usage source code:

    // import the package
    const RottenReviews = require('rotten-reviews')
    
    // https://www.rottentomatoes.com/m/venom_2018
    //                                  ^^^^^^^^^^
    const movieSlug = 'venom_2018'
    
    // obtain 3 audience reviews
    const reviewCount = 3
    
    // determines whether is a tv show or not,
    // optional and defaults to false
    const isTV = false
    
    // scrapes the review pages and returns via promise
    RottenReviews.getAudienceReviews(movieSlug, reviewCount, isTV).then(
      reviews => {
        console.log(JSON.stringify(reviews, null, 3))
      }
    )

You can view more examples by opening the examples folder.

Roadmap

  • Scrape defined number of reviews instead of pages (#6)
  • Error handling if movie page doesn't exist (#2)
  • Include scraping TV series reviews (#8)

Credits

  • axios for fetching webpages
  • cheerio for scraping the webpage contents
  • commander.js for running this package as a CLI app
  • json2csv for converting scraped reviews to CSV on the CLI app
  • pkg for compiling to binaries

License

MIT

rotten-reviews's People

Contributors

199911 avatar aksungurlu avatar crclark96 avatar fpereira1 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.