npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rt-scraper

v1.0.5

Published

This package, without an API key, will scrape the front page of RottenTomatoes.com for the movies opening this week, top box office, and coming soon.

Downloads

18

Readme

About

This package scrapes the front page of RottenTomatoes.com for data.

This is done without using an API key.

The information returned includes movies opening this week, top box office, and coming soon.

For each movie some information will be returned:

  • Title
  • Rotten Tomato meter rating (i.e. 93%, 45%, etc), or will show no score yet if not available
  • Release date, for the opening this week and coming soon datasets
  • US domestic gross, for the top box office dataset

Installation

npm install rt-scraper

Usage

There is only one method to this package: getRottenTomatoesScraperData(callback)

This method requires the use of a callback, which can be specified or anonymous. The callback has two parameters in the form of function(error, data).

If there was an error, like failed HTML request or bad parsing, error will be true and data will be null. Otherwise, error will be false and data will be a javascript object.

The data object has three keys: openingThisWeek, boxOffice, comingSoon. Each of these keys has for a value an array of movie objects.

Each movie object contains a title and meter key, where title is the name of the movie and meter is it's Rotten Tomato meter score. Note that if no score is available this value can be equal to "No Score Yet" rather than "93%" or "45%".

The openingThisWeek and comingSoon* keys will have movies with a date which references the movie's release date. This value will be in the form of "Mar 3" or "Sep 12".

The boxOffice key will have movies with a gross which references the US domestic gross of that movie. This value will be in the form of "$11.2M" or "$120.7M"

Examine the usage and data return examples for best results.

Usage Example

// Usage example of rt-scraper package
// See https://www.npmjs.com/package/rt-scraper

var rtscraper = require('rt-scraper');

console.log('Usage example of the rt-scraper package.')

rtscraper.getRottenTomatoesScraperData( function(error, data) {
        if (!error) {
            console.log(JSON.stringify(data, null, 2));      
        }
        else {
            console.log('Some error occured.');
        }
    });

Data Return Example

{
  "openingThisWeek": [
    {
      "meter": "100%",
      "title": "Get Out",
      "date": "Feb 24"
    },
    {
      "meter": "30%",
      "title": "Collide",
      "date": "Feb 24"
    },
    {
      "meter": "44%",
      "title": "Rock Dog",
      "date": "Feb 24"
    },
    {
      "meter": "85%",
      "title": "The Girl With All the Gifts",
      "date": "Feb 24"
    },
    {
      "meter": "100%",
      "title": "My Life as a Zucchini (Ma vie de courgette)",
      "date": "Feb 24"
    }
  ],
  "boxOffice": [
    {
      "meter": "91%",
      "title": "The Lego Batman Movie",
      "gross": "$32.7M"
    },
    {
      "meter": "8%",
      "title": "Fifty Shades Darker",
      "gross": "$20.3M"
    },
    {
      "meter": "35%",
      "title": "The Great Wall",
      "gross": "$18.5M"
    },
    {
      "meter": "90%",
      "title": "John Wick: Chapter 2",
      "gross": "$16.3M"
    },
    {
      "meter": "30%",
      "title": "Fist Fight",
      "gross": "$12.3M"
    },
    {
      "meter": "92%",
      "title": "Hidden Figures",
      "gross": "$7.3M"
    },
    {
      "meter": "75%",
      "title": "Split",
      "gross": "$7.2M"
    },
    {
      "meter": "34%",
      "title": "A Dog's Purpose",
      "gross": "$5.8M"
    },
    {
      "meter": "93%",
      "title": "La La Land",
      "gross": "$4.6M"
    },
    {
      "meter": "39%",
      "title": "A Cure For Wellness",
      "gross": "$4.4M"
    }
  ],
  "comingSoon": [
    {
      "meter": "96%",
      "title": "Logan",
      "date": "Mar 3"
    },
    {
      "meter": "No Score Yet",
      "title": "Table 19",
      "date": "Mar 3"
    },
    {
      "meter": "No Score Yet",
      "title": "The Shack",
      "date": "Mar 3"
    },
    {
      "meter": "64%",
      "title": "Before I Fall",
      "date": "Mar 3"
    },
    {
      "meter": "74%",
      "title": "Lovesong",
      "date": "Mar 3"
    }
  ]
}