Skip to content
Scrape audience reviews from Rotten Tomatoes 🍅
Branch: master
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 📝 Add github related templates Dec 20, 2018
demo Change default review count and update demo Feb 13, 2019
examples ♻️ Refactor and cleanup for v2.3.0 Feb 12, 2019
src
.gitignore ⚡️Resolve #68: Added ES module support Dec 20, 2018
.prettierignore
.prettierrc
LICENSE 🎉 Version 2 rewrite Dec 20, 2018
README.md Change default review count and update demo Feb 13, 2019
greenkeeper.json 📝 Lints and cleanups Dec 22, 2018
now.json
package.json 🔖 Bump to v2.3.1 Feb 13, 2019
rollup.config.js
tsconfig.json ♻️ Refactor and cleanup for v2.3.0 Feb 12, 2019
yarn.lock ♻️ Refactor and cleanup for v2.3.0 Feb 12, 2019

README.md

rotten-reviews

Scrape audience reviews from Rotten Tomatoes 🍅

NPM version NPM download count Greenkeeper badge Join the community on Spectrum

Rotten GIF

Description

This Node.js package fetches Rotten Tomatoes audience reviews (movies and TV shows) by scraping pages using cheerio and node-fetch. Notable features such as:

  • Search movie or TV show titles
  • Fetch whole audience reviews or by defined value
  • Compiled from Typescript to CommonJS and ES modules
  • Typescript declaration file available

Note that this package doesn't use official packages or API endpoints provided by RT.

Usage

Adding to your project

  • Using npm

    npm install rotten-reviews
  • Using yarn

    yarn add rotten-reviews

Search titles using searchByQuery

  • Script

    // using require (commonjs)
    const { searchByQuery } = require('rotten-reviews')
    
    // using import (es module)
    import { searchByQuery } from 'rotten-reviews'
    
    searchByQuery('venom').then(results => {
      console.log(JSON.stringify(results, null, 2))
    })
  • Output (truncated, fetched on December 20, 2018)

    [
      {
        "title": "Venom",
        "year": 2018,
        "type": "m",
        "slug": "m/venom_2018"
      },
      {
        "title": "Venom",
        "year": 2016,
        "type": "m",
        "slug": "m/venom"
      },
      ...
    ]

Fetch reviews using scrapeReviews

  • Script

    // using require (commonjs)
    const { scrapeReviews } = require('rotten-reviews')
    
    // using import (es module)
    import { scrapeReviews } from 'rotten-reviews'
    
    scrapeReviews('m/venom_2018').then(results => {
      console.log(JSON.stringify(results, null, 2))
    })
  • Output (truncated, fetched on December 20, 2018)

    [
      {
        "reviewer": "Cory L",
        "date": "December 19, 2018",
        "stars": 4,
        "review": "After watching the movie I gotta say it was good. It doesn't need spider Man though I would love to see that interaction. I am looking forward to seeing a sequel."
      },
      {
        "reviewer": "Shawn R",
        "date": "December 19, 2018",
        "stars": 4,
        "review": "Critics be damned, I liked it. Lots of action, and it doesn't take itself too seriously. Venom was given a bit of personality rather than being a glorified sticky suit."
      },
      ...
    ]

CLI usage

Starting from version 2, rotten-reviews does not include any runnables. Instead, we made rotten-reviews-cli which is a CLI wrapper for rotten-reviews.

Lambda Deployment

Powered with Zeit Now, we created a lambda deployment that you can consume to search and scrape on rotten-lambda.now.sh using these queries:

  • q to search titles (e.g. spider verse)
  • s to scrape reviews using title slugs obtained from search (e.g. m/venom_2018)
  • c to define how many to scrape (works only with s)

Example queries:

You can view the source code for the deployment on the demo directory or on the deployment source page.

API

Haven't done this part. Do submit a pull request if you want to contribute.

Related

License

MIT

You can’t perform that action at this time.