Forum

VL.Youtube

Some examples how to use the Youtube Data API (v3) in VL.

Words auf caution:

  • I don’t really know what I am doing
  • This is rather a doodle than a real WIP
  • It was created over the course of several month, the structure isn’t very consistent
  • It’s only superficially tested
  • The API has lots of parameters the ones I used were chosen arbitrarily
  • There is no error/exception handling (for now)

You can get it here:

Open the definitions patch to get an overview of the available examples. (Alt+Shift+A)


Getting Started

1. You’ll need a google account:
https://www.google.com/accounts/NewAccount

2. If you have an account log in, go to youtube and create a channel
https://www.youtube.com/channel/

3. Create a project in the Google developer console
https://console.developers.google.com

image

...

image

4. Obtain authentication credentials for the project you’ve created
https://console.developers.google.com/projectselector/apis/credentials

4.1 Go to OAuth consent screen, set an Application Name and save

4.2 Select ApiKey from Create Credentials

image

4.3 Select OAuth client ID from Create Credentials

image

image

5. Normally there is a “3-legged OAuth flow” that needs to be implemented by applications for authentication. But it’s also possible to authenticate using a long-lived so called refresh token.
To obtain such a token go to:
https://developers.google.com/oauthplayground/

5.1 Click on Oauth 2.0 Configuration

5.2 Activate Use your own OAuthcredentials

5.3 Enter your OAuth Client ID and OAuth Client Secret

0%20Playground

5.4 On the left hand side select the APIs you want to authorize and click the Authorize APIs button

image

5.5 Maybe you’ll have to sign in or select your google account

5.6 Most likely you will then be greeted by a warning, click on Advanced and then Go to YourProjectName (unsafe)

image

5.7 Now grant the permissions

image

Confirm

5.8 Back on the Playground Click on Exchange authorization code for tokens Button

5.9 Copy the Refresh Token and keep it somewhere safe

Token

6. You can now use OAuth Client ID , OAuth Client Secret and Refresh Token in VL.Youtube for authentication

7. For “simple” requests like searches you can also use the API key

See also:

Last but not least:
Youtube assigns a quota to each user/application currently it’s 10.000. Every request has a certain quota cost. Most operations are “cheap”, uploading a video though currently has a quota cost of at least 1.600, so one is limited to about 6 videos per 24h - it doesn’t matter how short/small videos are.
You can try to have your quota raised but it’s a rather lenghty process and it’s not certain if a higher quota will be granted and when.
https://services.google.com/fb/forms/ytapiquotarequest/

Thanks to @tonfilm for:

5 Likes