How to play a movie trailer with YouTube

Hello there!

I’ve been trying to display a movie trailer with no luck. Here is the scenario: the user type in a movie, the system search for that title on YouTube and returns the proper trailer.

The plan is to be able to search {movie name + trailer} on Youtube API, get the ID of the first result, then display it through bubble’s video element or link. I’m currently stuck in first step.

I’ve been trying to set up the YouTube API but I get this error message:

Here is my config (pretty new to APIs so bear with me):

Any ideas on how to do this? :slight_smile:

I’m also open to other strategies if this one is not the most efficient

Change your Auth method to “Private key in URL” and change the Key name to just “key”

When I change to “private key in URL” I get this:

If I change the key name from “private_key” to “key”, the button just says “call initialized” and I get no further feedback

Try generating a new key without http restrictions first in the Google console under Credentials and switch it out. Also make sure you have the YouTube data API enabled in the same console.

When you get a successful response, you can update the key with http restrictions.

When I looked at this recently, it did seem as though you can’t use the search API via a service account.

Seemed that youtube don’t like you searching youtube from a server.

What you CAN do is grab the trailer if you know the id.

Oh interesting about service account. I used a personal Google account and it went through ok.

Yes, so I think the way it works is that if you ask someone to sign up with their personal account (OAUTH) then you can use that.

But if you try to have your SA do it, it won’t work.

Was trying to bulk classify some videos, and it wasn’t working.

If there is a way round it then am all ears.