-->

Google YouTube API (v3): how to access my unlisted

2019-08-12 02:18发布

问题:

I've been experimenting with Google YouTube API (v3).
Until today, I used it with public videos.
Now I have the requirement to work with unlisted videos (for example, retrieve the list of my uploaded videos on a channel).
I see in the docs I should use google-api-php-client libraries.
This library requires an OAuth 2.0 client ID. This library requires interactive authorization from client (it's oauth2, of course. Actually in the code samples is always included an html section.

Now the question is:

I need to access to my unlisted (or private, possibly) videos server-side: I would need an unattended, server-to-server kind of authentication. Is it possible? If it is, then how?

回答1:

You can save a refresh token in your server and request new access tokens from there going forward.

Otherwise, only if you have access to Content ID API, you can use service accounts and onBehalfofContentOwner parameter instead.