omdbapi icon indicating copy to clipboard operation
omdbapi copied to clipboard

Error: Column `Ratings` must be length 1, not 0

Open robinpellegrims opened this issue 5 years ago • 3 comments

For some reason, omdbapi sometimes returns an empty value for the Ratings field (probably a bug on their side). But when this happens, this library's functions throw the following error:

Error: Column 'Ratings' must be length 1, not 0

Can be handled more gracefully? It is still interesting to get all the other fields as a result.

Example call: find_by_id('tt6911608', type='movie', include_tomatoes = TRUE)

Omdb api response: {"Title":"Mamma Mia! Here We Go Again","Year":"2018","Rated":"PG-13","Released":"20 Jul 2018","Runtime":"114 min","Genre":"Comedy, Musical","Director":"Ol Parker","Writer":"Ol Parker (screenplay by), Richard Curtis (story by), Ol Parker (story by), Catherine Johnson (story by), Judy Craymer (originally conceived by), Catherine Johnson (based on the original musical by)","Actors":"Lily James, Amanda Seyfried, Meryl Streep, Dominic Cooper","Plot":"In this sequel to Mamma Mia!, Sophie learns about her mother's past while pregnant herself.","Language":"English","Country":"UK, USA","Awards":"N/A","Poster":"https://m.media-amazon.com/images/M/MV5BMjEwMTM3OTI1NV5BMl5BanBnXkFtZTgwNDk5NTY0NTM@._V1_SX300.jpg","Ratings":[],"Metascore":"N/A","imdbRating":"N/A","imdbVotes":"N/A","imdbID":"tt6911608","Type":"movie","DVD":"N/A","BoxOffice":"N/A","Production":"Universal Pictures","Website":"N/A","Response":"True"}

I'm guessing the issue is in using dplyr::as_data_frame on the following line: https://github.com/hrbrmstr/omdbapi/blob/593775319bc8ce1ad004e3a20a73369fd98247b2/R/title_or_id.R#L89

robinpellegrims avatar Jul 22 '18 20:07 robinpellegrims