Search code examples
youtubemovies

How to specify movie trailers using Youtube API


I'm trying to get just official movie trailers from the Youtube API, but it's difficult to get consistent results.

The closest I seem to get is using the following url:

http://gdata.youtube.com/feeds/api/videos/-/MOVIE-TITLE?max-results=1

It sometimes works well:

http://gdata.youtube.com/feeds/api/videos/-/The-A-Team?max-results=1

Other times, not as well, for example:

gdata.youtube.com/feeds/api/videos/-/The-Twilight-Saga:-Eclipse-[DVD]-The-Twilight-Saga:-Eclipse?max-results=1

I'm wondering if anyone knows of a good way to specify official movie trailers? I'd rather have no match than an irrelevant one ;)


Solution

  • If you append "-trailer" to the MOVIE-TITLE you should get better results.