Skip to content
A website that shows a movie that's doing about as well as the president.
JavaScript CSS HTML
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.
lib
public
routes
src
views
.gitignore
Procfile
README.md
app.js
apt-packages
gulpfile.js
movies.json
package-lock.json
package.json

README.md

Rotten Trumpatoes

A stupid project inspired by a tweet.

screenshot


How

Every hour, scrape FiveThirtyEight (using puppeteer) to get Trump's approval rating. On request, return a random movie from a DB (er, JSON file) with the same rating on Rotten Tomatoes as the approval rating.

The DB was created by scraping 150 pages of the TMDb /discover endpoint, pulling in additional information (Rotten Tomatoes score and poster url) from OMDB, then searching Rotten Tomatoes (literally by scraping https://www.rottentomatoes.com/search/?search=MOVIE_TITLE, again with puppeteer) and parsing the results to find the Rotten Tomatoes url. I had to introduce a delay (here) because I think somebody found out what I was doing and started throttling my requests.

Why

¯\(ツ)


Deployment

[Mostly for my own reference, I have no idea why you would want to do this.]

Dokku

Rotten Trumpatoes is set up to be deployed via dokku (which I love very much). Puppeteer relies on dependencies that aren't in the default docker container so you'll need to install the dokku-apt plugin (which automatically pulls from apt-packages). I stole this approach from dokku-puppeteer-example.

process.env

I use dotenv, which relies on a .env at the root of the project. Because this file isn't version controlled, you'll have to set the environment variables on dokku as well (like so). For local development, add a .env with the following:

MOVIEDB_API_KEY=foo
OMDB_API_KEY=bar

Instructions to get a MovieDB API key are here and you can get an OMDB API key here.

You can’t perform that action at this time.