Scrape audience reviews from Rotten Tomatoes 🍅
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
bin
examples
features
test
.gitignore
.prettierrc
.travis.yml
LICENSE
README.md
index.js
index.test.js
package-lock.json
package.json

README.md

rotten-reviews

Scrape audience reviews from Rotten Tomatoes 🍅

Gitter Greenkeeper badge codecov Total alerts Language grade: JavaScript

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>

Scrapes audience movie or tv show reviews from rotten tomatoes

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

Options:
  --json      exports 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 --max 2
Noelle C             I liked it. It wasn't horribly gruesome and the story was pretty good
3 stars.             considering the challenges of making a Spiderman villain without spiderman. I
October 17, 2018     thought Eddie was a bit too NEW YORK and San Francisco was a little too clean
                     and not filled with weirdos to be realistic, but if I think of it like a
                     cartoon, it was perfect.


                     -
Chris S              Saw this last night, and enjoyed it very much. Not sure why the critics loathe
4 stars.             it so bad. It's an anti-hero movie. The interaction between Venom and Brock is
October 17, 2018     hilarious. Tom Hardy plays the broken man very well. There were several moments
                     where the jokes had the entire theater laugh at the same time. The action and
                     pacing of the movie are good. Professional critics are too full of themselves.
                     They expect an action flick to be Oscar level, when literally nobody else does.


                     -
Jeremy C             The critics were too hard on the film, very much worth going to see. My dad and
5 stars.             I loved it.
October 17, 2018

                     -

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

Version 1.1.0

  • 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
  • columnify for prettifying the CLI output
  • pkg for compiling to binaries

License

MIT