First of all I presume adult = porn films in the API docs? If so when I set this boolean to false it does not stop these kinds of films pulling through, even when it is set to true in the request url it still pulls through? How do I stop showing porn in my API results?
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by lineker
on June 13, 2018 at 6:03 PM
Just to be sure it's not a definition error, can you give an example of such a movie?
(Or never mind, I read it incorrectly. You are seeing entries set to adult:true coming through, when they should not. Ignore my question then! Someone else can hopefully help you out.)
Reply by Travis Bell
on June 14, 2018 at 11:08 AM
Hi @SomeT,
What's an example request that is returning some adult items?
Reply by SomeT
on June 14, 2018 at 12:32 PM
Here is my full code: JsFiddle link
Basically it would be good to only show common and popular films as well but I can't quite work that out, the issue is, if I use latest then it shows stuff shown in cinema and such, I need just popular films (e.g. gravity which was released years ago but is still popular) and latest released films and NOT to show any porn films (it takes a few runs by the way for it to show a porn film poster etc...)
Reply by Travis Bell
on June 14, 2018 at 12:40 PM
Adult items are not shown by default, so I'll need a specific URL to see the items that are being returned.
All items have an
adult
field, is theadult
field set totrue
orfalse
on the items that are coming back? I suspectfalse
...Reply by SomeT
on June 14, 2018 at 12:44 PM
It is set to false. It is on line 4 of the Jsfiddle link in my previous post. However it is: https://api.themoviedb.org/3/movie/?language=en-US&include_adult=false&api_key=REDACTED" then a few things after:
var rng = (Math.floor(Math.random() * 520271) + 1); var APIurl = baseUrl + rng + apiKey; console.log("Url it is loading the data from: " + APIurl);// for testing / debugging fetch(new Request(APIurl))
It is best to look at the code I linked.
Reply by Travis Bell
on June 14, 2018 at 12:57 PM
So an example request you're making that is returning an adult item is an actual movie "get details" call? Ie:
If so, there's no way to filter adult items with a param, you're requesting the full movie data in that case. What you'll need to do is get the response and check the
adult
field. If it's true, head off and request another until you get an item that has theadult
field set tofalse
.Reply by SomeT
on June 14, 2018 at 1:02 PM
Ah good idea, as an alternative what would work better to display more relevant and 'popular' films not JUST latest releases? I can't figure out how from the docs but I believe this would be a good way around it.
Reply by Travis Bell
on June 14, 2018 at 1:32 PM
/discover/movie is your best bet in that case and discover does have a proper adult filter (which is enabled by default) so you don't need to worry about anything in that case.
Discover has over 25 different filters and sort options and you can build all kinds of crazy queries with it. There's some examples here.
Reply by SomeT
on June 14, 2018 at 1:36 PM
Many thanks!
Reply by SomeT
on June 14, 2018 at 3:03 PM
@travisbell I am now trying to load just one movie like I was doing previously with a movie id, I want to do something similar with discover:
So firstly I have took the discover url and I can see via cURL it returns thousands of results via: https://api.themoviedb.org/3/discover/movie/?page=1&include_video=false&include_adult=false&sort_by=popularity.desc&language=en-US&api_key=REDACTED
It is returning thousands of results, so I look at the discover docs, https://developers.themoviedb.org/3/discover/movie-discover the query strings listed on this page do not have ID, so overall how would I specify the request url to only do one movie? I noticed it has page = 1 but I have no idea what this means...?
Reply by SomeT
on June 14, 2018 at 3:15 PM
Basically @travisbell I just want to obtain one movie from the API using discover.