The Movie Database atbalsts

Hey! Wondering if there's any way we can get support for append_to_response on the /discover/movie endpoint? I'm building a movie trailer website right now and love the API, but I end up sending a ton of requests to find movies with trailers (as some don't have any).

The code ends up looking something like this:

attemptForTrailers() {
  let foundTrailer = false;
  let attempts = 0;

  while(!foundTrailer && attempts < 20) {
    const movies = fetchMovies();
    const randomMovie = randomItem(movies.results);
    const details = fetchDetails(randomMovie.id);
    if (details.videos.results.length) {
      foundTrailer = true;
      fireSuccessAction();
    } else {
      attempts += 1;
    }
  }
  if (!foundTrailer) fireFailureAction();
}

This works fine, but it is not rare to make 20+ requests and/or reach the API request limit to find one trailer. Would love to make this simpler. Even better would be be filtering based on whether or not they have videos, but even just having the append_to_response param would drastically reduce the amount of necessary requests.

Much appreciation!

4 replies (on page 1 of 1)

Jump to last post

Hi @conordavidson,

There is no plan to add append on any of the list methods. I've heard about trailers in the past and I think there might be a separate set of methods I create down the road to help discover/find/retrieve trailers and videos.

Sounds good. Do you have any other suggestions for how to use the API in order to get the desired data or do you feel like this is an acceptable pattern?

For now that's about all you can do. There isn't really an alternative I can suggest.

Ok. Appreciate the help!

Nevari atrast filmu vai TV pārraidi? Jāpiesakās, lai to izveidotu.

Vispārējs

s fokusēties uz meklēšanas joslu
p atvērt profila izvēlni
esc aizvērt atvērtu logu
? atvērt īsinājumtaustiņu logu

Informācijas nesēju lapās

b atgriezties (vai pie vecākiem, ja nepieciešams)
e doties uz labošanas lapu

TV sezonas lapās

(labā bultiņa) pāriet uz nākamo sezonu
(kreisā bultiņa) pāriet uz iepriekšējo sezonu

TV sērijas lapās

(labā bultiņa) pāriet uz nākamo sēriju
(kreisā bultiņa) pāriet uz iepriekšējo sēriju

Visās attēlu lapās

a atvērt attēla pievienošanas logu

Visās labošanas lapās

t atvērt tulkošanas atlasītāju
ctrl+ s iesniegt veidlapu

Diskusiju lapās

n radīt jaunu diskusiju
w pārslēgt skatīšanās stāvokli
p pārslēgt publisko/privāto
c pārslēgt aizvērt/atvērt
a atklāta darbība
r atbilde uz diskusiju
l doties uz pēdējo atbildi
ctrl+ enter iesniegt savu ziņojumu
(labā bultiņa) nākamajā lapā
(kreisā bultiņa) iepriekšējā lapa

Iestatījumi

Vēlies novērtēt šo vienumu vai pievienot to sarakstam?

Pieteikties