10
This is a simple(ish) web scraping challenge.
Input
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.
Output
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.
Example
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.
O_O NC-17 sounds bad – Christopher – 2017-09-26T10:54:59.513
1NC-17, unlike the others, is supposed to be inappropriate. :P – totallyhuman – 2017-09-26T11:07:11.790
Should my answer return more than one movie? – BlackCap – 2017-09-26T11:29:52.920
1@BlackCap Edited the question. That's up to you. – None – 2017-09-26T11:32:37.343
Zootropolis or Zootopia? – BlackCap – 2017-09-26T11:44:59.497
@BlackCap They are the same movie I believe just renamed for different countries. – None – 2017-09-26T13:04:54.107
This challenge should be edited so the answer isn't a simple web request to the rottentomatoes API. – Tom – 2017-09-26T13:12:42.357
@Tom I think the current answerers wouldn't like that. But it's not quite a simple web request currently, there is json to parse (or grep). – None – 2017-09-26T13:13:36.543
Would it break a rule if someone created a
goo.gl
link to decrease the link address size? – Robert Benson – 2017-09-26T17:09:45.693@RobertBenson Yes.
– totallyhuman – 2017-09-26T17:31:08.247PG-13
doesn't seem to appear in the API, onlyPG13
does. Consider changing your question to account for that. – Okx – 2017-09-26T19:01:47.723I'll be saving some of the answers to help when I can't pick a movie...fun puzzle! – BruceWayne – 2017-09-27T00:05:08.893
I'm not sure where people have found this API address, but as best as I can tell, this challenge seems to go against the policies of Fandango (the owner of rottentomatoes) as can be viewed here and from their ToS linked from there.
– Tahg – 2017-09-27T04:28:17.343In looking into the API's JSON, I have discovered that it will, by default, only return 32 results at at a time. There are however 123 films (as of this writing) with a score of 98 (for example) meaning that there is a possibility that, although films might exist with the given score and rating, they may not be returned in those 32. More results can be requested using the
limit
parameter but the maximum is 876 and there are currently 1315 films with a score of 100 (for example) - the other 439 can be retrieved by adding thepage
parameter. – Shaggy – 2017-09-27T13:29:28.723Does this information invalidate all answers, including my own? – Shaggy – 2017-09-27T13:29:55.240
@Shaggy Only if you can find a case where your code doesn't give the right answer in practice. – None – 2017-09-27T13:30:38.180