omdbapi / OMDb-API

The Open Movie Database Bug Tracking
417 stars 21 forks source link

[Feature Request] Include/exclude genre from search #31

Open duckdoom5 opened 6 years ago

duckdoom5 commented 6 years ago

When searching with &type=series, I would like to have the option to exclude cartoons/anime

Example:

http://www.omdbapi.com/type=series&s=flash

I'm looking for the series "The flash", but the result also includes cartoons/anime

The preferred solution would be to have a setting for including or excluding genres.

ex: &genre=!animation|sci-fi the ! indicating to exclude the genre

Grauen commented 6 years ago

Do you think it's a good approach to exclude only the animation genre via search parameter? Maybe one day you would like to keep anime titles only. Or maybe you would like to exclude drama from your search. What we want is excluding specific genres.

I guess OMDB is using the advanced search function of IMDB. They parse the results and provide them as Json or xml. so OMDB is limited to whatever IMDB is providing to search for items. http://www.imdb.com/search/title?title=flash&title_type=tv_series So this would require the search to be able to exclude or include genres.

There is a topic on how to exclude genres from the search results here: https://getsatisfaction.com/imdb/topics/excluding_genres_in_advanced_title_search However - this didn't work for me. It just changed the order of the returned results, but I still had items, which had animation listed as a genre, in my list.

What you could do now

Each search result currently returns the imdb-id of the item which is found by the search. ` Title "Flash Gordon"
Year "2007–2008"
imdbID "tt0959086"
Type "series"

`

Next step would be to iterate all results and make another omdb request. http://www.omdbapi.com/?i=tt0959086 This returns: {"Title":"Flash Gordon","Year":"2007–2008","Rated":"N/A","Released":"01 Aug 2007","Runtime":"60 min","Genre":"Action, Adventure, Drama","Director":"N/A","Writer":"Peter Hume","Actors":"Eric Johnson, Gina Holden, Karen Cliche, Jody Racicot","Plot":"Hometown Celebrity Steven \"Flash\" Gordon discovers a secret his father tried desperately to keep hidden. He then embarks on a journey to another dimension in hopes of finding his father who...","Language":"English","Country":"USA, Canada","Awards":"1 win & 6 nominations.","Poster":"https://images-na.ssl-images-amazon.com/images/M/MV5BMTY2Njc1MTgyNV5BMl5BanBnXkFtZTcwODYwNTI1MQ@@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"4.8/10"}],"Metascore":"N/A","imdbRating":"4.8","imdbVotes":"2,736","imdbID":"tt0959086","Type":"series","totalSeasons":"1","Response":"True"} Now have a look at the Genre (please notice my current issue https://github.com/omdbapi/OMDb-API/issues/32) - if it contains the Tag "Animation" you know you're not interested in this item and just filter it.

duckdoom5 commented 6 years ago

It'd be silly to just remove them from search completely and yes, it'd be better if you had the option to search genres, but the removal of anime/cartoons is a more pressing manner for me atm. which I why I requested it.

Requesting the details for every search result would be silly. You only have 1000 free API requests per day, and it would be overloading the server immensely. And don't forget the drastically reduced search speed. So no, that is not a good solution.

"I guess OMDB is using the advanced search function of IMDB" It gives different results leading me to believe it does not:

http://www.imdb.com/find?q=super&s=tt&ttype=tv Does include the title "Supergirl"

http://www.omdbapi.com/type=series&s=super Does not include the title "Supergirl" because it uses the "equals" method instead of the "contains" mehtod. (So different search engines)

francoisbruneau commented 4 years ago

Querying by genre would be awesome indeed.