omertron / api-omdb Goto Github PK
View Code? Open in Web Editor NEWAPI for the Open Movie Database
License: GNU General Public License v3.0
API for the Open Movie Database
License: GNU General Public License v3.0
Hey,
Thanks for the awesome work with the API. However, I think there might be a bug upon requesting long plots from OMDb. For instance, if I request the movie with IMDb ID tt0000628 with a long plot OmdbVideoFull result = omdb.getInfo(new OmdbBuilder().setImdbId(imdbID).setPlot(PlotType.LONG).setTomatoesOn().build());
I get the following JSON response:
{"Title":"The Adventures of Dollie","Year":"1908","Rated":"NOT RATED","Released":"14 Jul 1908","Runtime":"12 min","Genre":"Action, Short","Director":"D.W. Griffith, G.W. Bitzer","Writer":"Stanner E.V. Taylor","Actors":"Arthur V. Johnson, Linda Arvidson, Gladys Egan, Charles Inslee","Plot":"On a warm and sunny summer's day, a mother and father take their young daughter Dollie on a riverside outing. A gypsy basket peddler happens along, and is angered when the mother refuses to...","Language":"English","Country":"USA","Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BMDlmYzgwZmItNzdlMS00ZmE5LThkYmUtYmNhNjAyY2FlMmFiXkEyXkFqcGdeQXVyMTYxNjkxOQ@@._V1_SX300.jpg","Metascore":"N/A","imdbRating":"5.7","imdbVotes":"443","imdbID":"tt0000628","Type":"movie","Response":"True"}
Note the "..." in the end of the plot result. This is the short version of the plot according to OMDb. The long version result should have been:
{"Title":"The Adventures of Dollie","Year":"1908","Rated":"NOT RATED","Released":"14 Jul 1908","Runtime":"12 min","Genre":"Action, Short","Director":"D.W. Griffith, G.W. Bitzer","Writer":"Stanner E.V. Taylor","Actors":"Arthur V. Johnson, Linda Arvidson, Gladys Egan, Charles Inslee","Plot":"On a warm and sunny summer's day, a mother and father take their young daughter Dollie on a riverside outing. A gypsy basket peddler happens along, and is angered when the mother refuses to...","Language":"English","Country":"USA","Awards":"N/A","Poster":"http://ia.media-imdb.com/images/M/MV5BMDlmYzgwZmItNzdlMS00ZmE5LThkYmUtYmNhNjAyY2FlMmFiXkEyXkFqcGdeQXVyMTYxNjkxOQ@@._V1_SX300.jpg","Metascore":"N/A","imdbRating":"5.7","imdbVotes":"443","imdbID":"tt0000628","Type":"movie","Response":"True"}
Could you please check it?
can you please publish its jar?
OmdbApi.txt
Hi Team,
OmdbApi class needs to be updated for method getInfo() and search().
The following code needs to be added :
if (!parameters.has(Param.APIKEY)) { parameters.add(Param.APIKEY, this.apiKey); }
Current Design: As soon as request comes to API , it adds APIKey, which is fine if the client has used parameterised constructor to create Object. But problem comes when client has used default constructor to create object and passing APIKey in OMDBParameter list.
But since we are adding searchParams.add(Param.APIKEY, this.apiKey);
, the value of APIKey ggets overridden in Omdbparameters with default null value.
Issue: User is forced to use OmdbApi object in application with APIKey, which might not be suitable for different user for different needs.
File with suggested code is attached
Hi,
your API has a little documentation leak. I need several times to understand, when I make a OmdbAPI.search request with a OmbdBuilder.setTitle() parameter, the api-omdb-search doesn't return any results, because it makes a call to omdbapi.com/?t=... instead of omdbapi.com/?s=...
The reason is - the search() method wants to create a List of OmdbVideoBasic objects inside a SearchResult, but the builder produces a query with "t" Title - and then OmdbApi.com only returns one entry. And then the JSON Mapper doesn't match (matching an SearchResult entry to SearchResult) and the result is ok, but empty (List==null).
I found a lot of AbstractJsonMapper trace log messages, that the JSON data couldnt be mapped...
So - either add an example to the documentation so that the search should only be used with OmdbBuilder.setSearchTerm() and never use OmdbBuilder.setTitle() in a search or make the builder/parser more robust against this issue.
SearchResults: Unknown property='totalResults' value='13'
OmdbVideoFull: Unknown property='tomatoURL' value='http://www.rottentomatoes.com/.../'
How can I convert the OmdbVideoFull object to JSON object?
Sorry, I'm a noob and have trouble putting this library on to my project.
It seems like they added key for omdb api. Would you please add it to your library?
Looks like new API keys are not working, is this still maintained?
Currently the version of api-omdb available in Maven Central is 1.4 and since OMDB API requires a key to work, we need to use 1.5. Building projects with a local clone of 1.5 is inconvenient.
Can you please release 1.5 into Maven Central?
Hello,
Would be nice to be able to retrieve episde / season number, when working on a TVshows.
Can be easily done by adding
@JsonProperty("Season") private Integer season; @JsonProperty("Episode") private Integer episode ;
and appropriate getters/setters in OmdbVideoFull.java
Thanks for this nice wrapper :)
The api won't work if the data received from omdb contains one or more fields with the value "N/A"
For example: "Runtime":"N/A".
EDIT: Found out I was using version 1.0 and it was fixed since 1.1
There are some duplicates for search results tried searching s=marvel.
http://www.omdbapi.com/?apikey=<api_key>=marvel&type=movie&page=1
outputs duplicates like Captain Marvel:
{
"Search": [
{
"Title": "Captain Marvel",
"Year": "2019",
"imdbID": "tt4154664",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BMTE0YWFmOTMtYTU2ZS00ZTIxLWE3OTEtYTNiYzBkZjViZThiXkEyXkFqcGdeQXVyODMzMzQ4OTI@._V1_SX300.jpg"
},
{
"Title": "Captain Marvel",
"Year": "2019",
"imdbID": "tt4154664",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BMTE0YWFmOTMtYTU2ZS00ZTIxLWE3OTEtYTNiYzBkZjViZThiXkEyXkFqcGdeQXVyODMzMzQ4OTI@._V1_SX300.jpg"
},
{
"Title": "Marvel One-Shot: All Hail the King",
"Year": "2014",
"imdbID": "tt3438640",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BYTQzNzZiOWItOTNlMC00MjA4LWI5ZTAtODk3MmQ2MGJiYTdmXkEyXkFqcGdeQXVyNTgzMDMzMTg@._V1_SX300.jpg"
},
{
"Title": "Marvel One-Shot: Item 47",
"Year": "2012",
"imdbID": "tt2247732",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BMTM2MzY1ODcyN15BMl5BanBnXkFtZTcwNTE3OTIxOA@@._V1_SX300.jpg"
},
{
"Title": "Marvel One-Shot: Agent Carter",
"Year": "2013",
"imdbID": "tt3067038",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BYzYyODBjY2MtZGU3MC00YWE3LWExOTUtMzkyMjNkYjUzNjA4XkEyXkFqcGdeQXVyNjA3OTI5MjA@._V1_SX300.jpg"
},
{
"Title": "Marvel One-Shot: A Funny Thing Happened on the Way to Thor's Hammer",
"Year": "2011",
"imdbID": "tt2011109",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BYmIxYzk2ZTItNTE1OC00NWRkLTkyOTEtMDM1ZjY5MjJlYWE4XkEyXkFqcGdeQXVyNjA3OTI5MjA@._V1_SX300.jpg"
},
{
"Title": "Marvel One-Shot: The Consultant",
"Year": "2011",
"imdbID": "tt2011118",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BMThhNWExYzgtYzQwOS00MDM5LWFmOGYtOGZhZDQ4MWYzMDNlXkEyXkFqcGdeQXVyNjA3OTI5MjA@._V1_SX300.jpg"
},
{
"Title": "Adventures of Captain Marvel",
"Year": "1941",
"imdbID": "tt0033317",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BNjg0NTk3NjUyNF5BMl5BanBnXkFtZTgwNDQ5MjM1MjE@._V1_SX300.jpg"
},
{
"Title": "Marvel Studios: Assembling a Universe",
"Year": "2014",
"imdbID": "tt3591568",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BNTAzNzAwZDktOThhZC00NWZmLTg2MGItMDY1MDQ4OWQ4Yjc3XkEyXkFqcGdeQXVyNTE1NjY5Mg@@._V1_SX300.jpg"
},
{
"Title": "Pokémon the Movie: Volcanion and the Mechanical Marvel",
"Year": "2016",
"imdbID": "tt5889204",
"Type": "movie",
"Poster": "https://m.media-amazon.com/images/M/MV5BZTUwZDEzZGEtYTJlYi00OTRkLWJmMzItODU0ZWViMTUyYjUzXkEyXkFqcGdeQXVyNzEyMDQ1MDA@._V1_SX300.jpg"
}
],
"totalResults": "88",
"Response": "True"
}
Some tv shows have metascore returned as "N/A". For example "Mr. Robot" would return metascore as "N/A", yet in model the value is mapped as integer, so it throws a mapping error. Similar to this:
com.omertron.omdbapi.OMDBException: ExceptionType=MAPPING_FAILED, ResponseCode=0, URL=http://www.omdbapi.com/?i=tt4158110
at com.omertron.omdbapi.OmdbApi.getInfo(OmdbApi.java:180)
at tvseriestracker.TvSeriesTrackerApplication.main(TvSeriesTrackerApplication.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.lang.Integer from String value 'N/A': not a valid Integer value
at [Source: {"Title":"Mr. Robot","Year":"2015–","Rated":"N/A","Released":"27 May 2015","Runtime":"60 min","Genre":"Crime, Drama","Director":"N/A","Writer":"Sam Esmail","Actors":"Rami Malek, Carly Chaikin, Portia Doubleday, Martin Wallström","Plot":"Follows a mysterious anarchist who recruits a young computer programmer (Malek) who suffers from social anxiety disorder and forms connections through hacking them.","Language":"English","Country":"USA","Awards":"1 win.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTE0Mjc1MTk2MjFeQTJeQWpwZ15BbWU4MDk2NzI4MDYx._V1_SX300.jpg","Metascore":"N/A","imdbRating":"9.4","imdbVotes":"21,489","imdbID":"tt4158110","Type":"series","Response":"True"}; line: 1, column: 566] (through reference chain: com.omertron.omdbapi.model.OmdbVideoFull["Metascore"])
at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:55)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.