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
...
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
4.3 Select OAuth client ID from Create Credentials
- Choose Web application
- Set a name
- Add OAuth 2.0 Playground to Authorized redirect URIs (needed in next step)
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:
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
5.4 On the left hand side select the APIs you want to authorize and click the Authorize APIs button
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)
5.7 Now grant the permissions
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
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:
- YouTube Data API की खास जानकारी | Google for Developers
- https://www.youtube.com/watch?v=hfWe1gPCnzc (a bit outdated)
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: