Rotten Tomatoes API Forums


RSS Feed

error parsing certain movies

    • ef80
    • Topic created 4 years ago

    i fail while trying to parse the data from the movie with url:

    i've also experienced this in a couple of other cases.

    it works in the browser, but not when i try to parse it in javascript or java.

    it looks like binary data..

    please advice.

    Message edited by ef80 3 years ago


  1. tmongy4 years ago

    Yeah I'm having the same problem with certain movies, though I'm using PHP to parse.

    I think the results are being returned with gzip encoding according to the header information

    "content-encoding": "gzip"

    Might this be the problem?

  2. ef804 years ago

    tmongy - i think thats the problem.. its strange RT would send only a few movies as gzip - and they should fix this (that is send UTF-8 only), but you should probably start looking for a lib to unzip it and check for the 'content-encoding'

  3. ef804 years ago

    ithe movie that had content of type gzip, is now normal text, and some new movies are gzip'ed (/api/public/v1.0/movies/770740154.json?apikey=...'. it seem very random.

  4. Steve N.4 years ago

    Hi ef80 and tmongy,

    If you do see this occurring again, can you share the relevant code you are using and the movies that this occurred on? It will help us duplicate on our side and see what the underlying issue is.


  5. ef804 years ago

    the movie detail request with this id is now of content-encoding=gzip: /api/public/v1.0/movies/771241234.json

    but the movies with which are encoded using gzip varies over time...

    just try to get a list of movie details.


  6. Steve N.4 years ago

    Thanks erlend,

    I wasn't able to reproduce yet. I tested the movie id you gave and the movie ids returned from the box office endpoint using the sample php code given. How intermittent is this, like 1 in 10 chance it happens when getting movie details?


  7. ef804 years ago

    i tried to recreate it in javascript/jquery, but i believe the browser is able to handle the gzip content correctly and i wasn't able to read the headers for checking this. try to get a list of details using a simple java script or similar or there should probably be someone there at RT who know's whats going on with the api/respones..? Hope you figure it out and make sure all responses are text only.

  8. tmongy4 years ago

    Right now I'm getting the gzip returned data for movie id 771252920

    I can see the error in the dynamic documentation tool provided by Rotten Tomatoes.

    Here is a screenshot of what it looks like:

  9. tmongy4 years ago

    Sorry the previous image link is wrong. Here is the correct one:

  10. Steve N.4 years ago

    Thanks tmongy,

    The screenshot is very helpful. I have raised the issue with the people who manage the iodocs. Are you seeing this in other places besides the iodocs? I know ef80 had mentioned using Java earlier. Do any of you have sample code that duplicates this behavior?

    Thank you,

  11. tmongy4 years ago

    Hi Steve,

    Yes, the issue occurs when I'm getting the data using a PHP script on my server.

    Here's part of the code I use (which works for movies that don't return the corrupt data):

    $search_url = "$api_key&q=$movie_name&page_limit=1";
    $search_data = json_decode(file_get_contents($search_url));
    $total_results = $search_data->total;
    $title = $search_data->movies[0]->title;
    $year_movie = $search_data->movies[0]->year;
    if ($total_results > 0){
      $distance = levenshtein($title,$row['movie_name']);
      if ($distance < 7 && $year_movie >= $year-2){ 
        $movie_api_url = $search_data->movies[0]->links->self;
        $movie_api_url = $movie_api_url . "?apikey=$api_key";
        $movie_data = json_decode(file_get_contents($movie_api_url));
        $rating =  $movie_data->mpaa_rating;
        $runtime =  $movie_data->runtime;
        $score =  $movie_data->ratings->audience_score;
  12. Steve N.4 years ago

    Following up on this thread. We are still investigating this issue. Since the issue is intermittent, we are having difficulty reproducing and investigating it. If anyone else sees this occurring, please let us know and provide as much detail as possible. The language used, the time it occurred and what movie or endpoint you saw it occur on.

    Thank you,

  13. McCool4 years ago

    I'm having issues as well. I'm using PHP and the script I've written is

    $url = "$id.json?apikey=$rotten_key";
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $data = curl_exec($ch);
    $search_results = json_decode($data);
    if ($search_results === NULL) die("Error parsing json in call_rotten_tomatoes " .$url);
    return $search_results;

    I added the url to the error message just to make sure I have it formatted correctly. So far I'm able to copy the url from the error message and use it directly in the browser to get results. Running my code now, I get errors on:








  14. McCool4 years ago

    Also add 770858174, it's the id for the new movie Battleship.

  15. monkeyNeil4 years ago

    Running through the list from McCool above, using, here are my results:

    771242835 - shows up fine at my end

    771269800 - fine

    770740154 - garbled, gzip encoded

    771252920 - garbled, gzip encoded

    771218292 - garbled, gzip encoded

    771305494 - fine

    770858174 - garbled, gzip encoded

    In each case, confirming what everybody else says, the only ones that are garbled include the line "content-encoding": "gzip", in the response headers.

  16. Jesse4 years ago

    Same issue here with mobile apps. Noticed it today with Are you switching to use gzip responses?

  17. Jesse4 years ago

    To note, I would be very happy with gzip responese : )

  18. McCool4 years ago

    Are the any updates on this issue? Thanks

  19. monkeyNeil4 years ago

    Hey McCool - let me know if you come up with a workaround for this. Seems there's no "official" answer coming.

  20. Jesse4 years ago

    The gzipped content is good, you can just check the response to see if it is gzip and if so uncompress it and continue on. Gzip responses are actually much faster!

  21. Eugene P.4 years ago

    [Official Answer] Hey guys this is Eugene from Rotten Tomatoes. We've isolated the issue and removed some performance caching in order to eliminate the issue for now. Let us know if you see the issue again!

  22. McCool4 years ago

    Thanks for the update. I have not noticed any issues.

  23. Icyplains3 years ago

    I have started experiencing this issue. Something had to have changed because everything has been fine up until a few days ago it seems.

[ Page 1 of 2 | Next ]