lacymorrow/movie-trailer

Cannot fetch TV trailers from TMDB

Closed this issue · 22 comments

Cannot fetch TV trailers from TMDB
aingc commented

Looks like it's because the public API key they use in this current iteration of movie-trailer is invalid. I am having the same problem.

Ah I'm so sorry @meet1807, I didn't see this until now. I'll try to have it fixed this weekend.

It seems to be working now, I'm worried that an API limit has been added that is being hit. Will look into this further.

hey, any news ? I'm having the same issue

TMDB claims not to have a rate limit but something is preventing a response:

As of December 16, 2019, we have disabled the API rate limiting. If you have any questions about this, please head over to https://www.themoviedb.org/talk/category/5047958519c29526b50017d6.

Can someone post an error they are having?

For those willing to test, I've published version 2.0.7 which supports a custom api_key using the flag --api_key or -k.

You can get a free key here: https://developers.themoviedb.org/

That said, I would really like to fix the issue so please post errors if possible.

TV shows are not supported by this library, I will be publishing a similar library soon.
Please post any errors you are receiving.

The issue still persists

Hi @AarshOza, can you elaborate on what is happening and post any errors?

Please post steps to replicate the error.

Hello @lacymorrow , the error occurs when attempting to fetch a resource from the search/movie endpoint because the API key is undefined. Since the id of the film cannot be retrieved due to the invalid API key, the second request to /movie/{id} is sent as undefined as well and will always return a 404.

The full request to the /search endpoint --> https://api.themoviedb.org/3/search/movie?api_key=undefined&query=Fate:%20The%20Winx%20Saga and returns an Invalid API key response.

The second request to the /movie/{id} endpoint --> https://api.themoviedb.org/3/movie/undefined/videos?api_key=9d2bff12ed955c7f1f74b83187f188ae and returns a "resource not found". Interestingly, the API key is present here but not in the first request.

Hope this helps!

The error occurs when attempting to fetch a resource from the search/movie endpoint because the API key is undefined. Since the id of the film cannot be retrieved due to the invalid API key, the second request to /movie/{id} is sent as undefined as well and will always return a 404.

I just tried fetching the resource using a custom api_key flag and that seemed to fix the errors.
The issues are:
A. The api_key flag in the first API call does not set to your API key by default if a custom API key is not provided
B. The error handling from the first API call does not work and passes the undefined response to the second API call to fetch the trailers.

Thanks for confirming @Tarek-23, I've added a few features and fixed the error handling in the most recent version, 2.1.0: https://github.com/lacymorrow/movie-trailer/releases/latest

Leaving this open as the original issue still stands, this library only supports movies, not TV shows.

Hey, I have a suggestion to make which I observed during building react web app in which I fetched movie trailer link using this API but wasn't able to receive for many of the movies, shows even after supplying their tmdb id as the parameters. Why don't we use youtube API internally to fetch trailers, and using parameters such as length of trailer < 4min, sort by relevance, and then picking 1st link from the array of links received. What do you think @lacymorrow

I'm hesitant to switch APIs for a few reasons, if anyone is currently using the library it will drastically change the results/order in some cases.
The bigger issue is that YouTube will return videos that are not necessarily the corresponding movie trailer, just close keyword matches. This means developers won't be able to rely on the videos being correct.

I'll think about it, but I'd probably create a new library if I wanted to switch APIs

Hey I am also having issues with this API! Apparently my trailerURL returns as undefined

I think the movieTrailer constructor is not recognizing the movieId for some reason?

What is the movieId you're using that's failing?

@calvieTech

What is the movieId you're using that's failing?

Nvm I fixed it @lacymorrow thanks