This is a simple(ish) web scraping challenge.


Your code should take an MPAA film rating and a number from 0 to 100 as input. It can do this in any way you find convenient.


Your code should return the name of any movie which has a) that film rating and b) the numerical score on the Tomatometer from rottentomatoes.

If there is no such movie it can output anything you like.

The possible MPAA film ratings are G, PG, PG-13, R, NC-17, NR.

Your code may report one or more movies, that is up to you.

To clarify, your code is meant to access the web to get the answers to queries.


Say the input is "PG, 98" then your code could output "Zootropolis".

Please show an example of your code working with the film rating PG and score 98 along with your answer.

  • \$\begingroup\$ O_O NC-17 sounds bad \$\endgroup\$
    – user63187
    Commented Sep 26, 2017 at 10:54
  • 1
    \$\begingroup\$ NC-17, unlike the others, is supposed to be inappropriate. :P \$\endgroup\$ Commented Sep 26, 2017 at 11:07
  • \$\begingroup\$ Should my answer return more than one movie? \$\endgroup\$
    – BlackCap
    Commented Sep 26, 2017 at 11:29
  • 1
    \$\begingroup\$ @BlackCap Edited the question. That's up to you. \$\endgroup\$
    – user9206
    Commented Sep 26, 2017 at 11:32
  • \$\begingroup\$ Zootropolis or Zootopia? \$\endgroup\$
    – BlackCap
    Commented Sep 26, 2017 at 11:44

6 Answers 6


Bash, 182 bytes

curl "https://www.rottentomatoes.com/api/private/v2.0/browse?minTomato=$2&maxTomato=$2&type=dvd-streaming-all" 2>/dev/null|grep -o "{[^}]*aRating\":\"$1\""|grep -Po 'title":"\K[^"]*'


$ bash script PG 98
The Island President
Inside Out
Love & Friendship
Long Way North (Tout en haut du monde)
  • \$\begingroup\$ I really like this answer. \$\endgroup\$
    – user9206
    Commented Sep 28, 2017 at 18:15

JavaScript (ES6), 167 162 159 bytes

Needs to be run from the root of rottentomatoes.com. Returns a Promise object containing the title.


If we can require that it be run in a specific directory then it becomes 139 bytes:

  • \$\begingroup\$ It would be great if there were a click and look way to test Javascript answers. \$\endgroup\$
    – user9206
    Commented Sep 28, 2017 at 18:17
  • \$\begingroup\$ @Lembik: normally that can be done when working with APIs but, in this case, RT's CORS policy prevents it. Thanks for the accept, by the way. \$\endgroup\$
    – Shaggy
    Commented Sep 28, 2017 at 18:22
  • \$\begingroup\$ Hmm..I just noticed there are shorter answers but I don't have the energy/expertise to test Stratos code right now. If I do, I will have to change the accept, sorry. \$\endgroup\$
    – user9206
    Commented Sep 28, 2017 at 18:25
  • \$\begingroup\$ @Lembik: I fully expected Stratos to get it (so far). \$\endgroup\$
    – Shaggy
    Commented Sep 28, 2017 at 18:26
  • \$\begingroup\$ Oh I added a bounty to the other find-a-movie question :) \$\endgroup\$
    – user9206
    Commented Sep 28, 2017 at 18:27

Python 2 + requests, 209 204 bytes

-5 bytes thanks to Ian Gödel.

lambda r,t:[i['title']for i in get('http://rottentomatoes.com/api/private/v2.0/browse?minTomato=%d&maxTomato=%d&type=dvd-streaming-all'%(t,t)).json()['results']if i['mpaaRating']==r]
from requests import*
  • 1
    \$\begingroup\$ Think you may need (t,t) where you have (r,r) \$\endgroup\$
    – ElPedro
    Commented Sep 26, 2017 at 12:47
  • 1
    \$\begingroup\$ You can use this link: http://rottentomatoes.com/api/private/v2.0/browse?minTomato=%d&maxTomato=%d&type=dvd-streaming-all (https -> http and drop the www.) for a couple of bytes saved. \$\endgroup\$
    – user74686
    Commented Sep 26, 2017 at 14:17
  • 1
    \$\begingroup\$ Could you show an example of your code being used please. \$\endgroup\$
    – user9206
    Commented Sep 26, 2017 at 18:55

Stratos, 133 bytes


Try it!

  • \$\begingroup\$ Could you show an example of your code being used please. \$\endgroup\$
    – user9206
    Commented Sep 26, 2017 at 18:54
  • \$\begingroup\$ @Lembik Well, run it, and type in the number, press enter, type in the rating, press enter, and it will give you the output. \$\endgroup\$
    – Okx
    Commented Sep 26, 2017 at 18:55
  • \$\begingroup\$ Can you drop the www.? \$\endgroup\$
    – Shaggy
    Commented Sep 26, 2017 at 20:22
  • \$\begingroup\$ @Shaggy Unfortunately not. \$\endgroup\$
    – Okx
    Commented Sep 27, 2017 at 15:06
  • \$\begingroup\$ Maybe you could just post a screenshot of it running? \$\endgroup\$
    – user9206
    Commented Sep 28, 2017 at 18:31

q/kdb+, 168 bytes


{(r(&)(r:.j.k[.Q.hg`$"https://www.rottentomatoes.com/api/private/v2.0/browse?type=dvd-streaming-all&min",t,"&max",t:"Tomato=",y]`results)[;`mpaaRating]like x)[;`title]}


q){(r(&)(r:.j.k[.Q.hg`$"https://www.rottentomatoes.com/api/private/v2.0/browse?type=dvd-streaming-all&min",t,"&max",t:"Tomato=",y]`results)[;`mpaaRating]like x)[;`title]}["PG";"98"]
"The Island President"
"Inside Out"
"Love & Friendship"
"Long Way North (Tout en haut du monde)"


.Q.hg           / fetch a URL
.j.k            / parse json string into Q dictionaries
`results        / index into dictionary with key `results
[;`mpaaRating]  / index into these sub dictionaries extracting mpaaRating
like x          / binary list where they match, e.g. "PG"
(&)             / where, list indices where true
[;`title]       / index into dictionary with key `title


  • If you want to try this out yourself, take a read through the Cookbook/SSL page to ensure your environment is setup correctly.
  • Fails if we remove the s of https, or the www., gives 301 Permanently Moved response.
  • \$\begingroup\$ Maybe add a link for "q/kdb+" in the title of your answer? A lot of people will never have heard of it and you can educate them (me). \$\endgroup\$
    – user9206
    Commented Sep 26, 2017 at 13:51
  • \$\begingroup\$ Done :) I was hoping to write a solution in oK but getting a 'No 'Access-Control-Allow-Origin' header is present...' when using the online repl (johnearnest.github.io/ok/index.html), so have falled back to the closed-source Q. \$\endgroup\$
    – mkst
    Commented Sep 26, 2017 at 13:57

JavaScript (ES2017), 158 bytes

async(r,n)=>(await(await fetch(`api/private/v2.0/browse?minTomato=${n}&maxTomato=${n}&type=dvd-streaming-all`)).json()).results.find(m=>m.mpaaRating==r).title

Run from the Rotten Tomatoes home page:

f=async(r,n)=>(await fetch(`api/private/v2.0/browse?minTomato=${n}&maxTomato=${n}&type=dvd-streaming-all`).then(x=>x.json())).results.find(m=>m.mpaaRating==r).title

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.