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.
- Node.js
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!"
},
...
]
-
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.
- Scrape defined number of reviews instead of pages (#6)
- Error handling if movie page doesn't exist (#2)
- Include scraping TV series reviews (#8)
axios
for fetching webpagescheerio
for scraping the webpage contentscommander.js
for running this package as a CLI appjson2csv
for converting scraped reviews to CSV on the CLI apppkg
for compiling to binaries
MIT