CUSTOM YOUTUBE APP USING YOUTUBE DATA API
BY KAREEM OLAYINKA
This is a simple web application to show build a custom youtube application using the youtube data API.
- Development requirements
- web browser
- text editor
- basic knowledge of html, CSS and Javascript
- Google developer account
- jQuery javascript library
- Steps involved;
- Create a Google developer account
You need to sign up for a Google developer account in order to have access to Google APIs.
This access enable you get an API key for the particular API you intend to use, YouTube data v3 in our case.
Link: https://developers.google.com
- Generate API key and activate your API.
In the developer’s console, we will generate an API key for our app then activate our API. The developer console gives us full control over our app since we can choose to activate or deactivate the key from there.
Link: https://console.developers.google.com
- Get jQuery.
jQuery is a popular javascript library that allows us to make use of javascript functionalities in an easier way. It has cross-browser compatibility.
We can include jQuery in our app in two ways;
- Download and include it using the script tag or
- Via CDN (Content Delivery Network) which requires internet access.
Links:
Download – https://jquery.com/download
CDN – https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
- Create Our App Structure.
With all we have, we can write our html code. We will create sections which will serve as containers for different data we will be receiving from our API.
We will also include our stylesheets, jQuery and our javascript file in our html document.
- Get playlist ID
Now we need our playlist ID. We can get this by searching for our favorite playlist on youtube then copying it from the URL of that particular playlist.
- Write our javasrcipt code
Now that we have all we need, we can now write our javascript code.
We can copy code snippets from provided in the documentation section of the YouTube data API.
But in our case, we are creating a very simple app to show us what we can do with the API.
Figure 1: Example Javascript Code