YouTube Integration in Outerbase

YouTube Integration in Outerbase

This article is about the development of the Youtube Outerbase command as part of the Outerbase & Hashnode hackathon

ยท

2 min read

Introduction

Outerbase Commands offer a flexible method for simplifying a variety of tasks within the Outerbase ecosystem. It will integrate any popular APIs to view the details of the desired functionality effortlessly. For more information about Outerbase commands, please refer to the official documentation here

This article discusses about the development of Outerbase command for YouTube integration.

Youtube

YouTube is a popular online video-sharing platform that allows users to upload, view, share, and interact with videos. YouTube has become an integral part of online culture, providing a platform for entertainment, education, information, and creativity for billions of users worldwide.

Youtube API Testing

Below is a quick python snippet that will test youtube video API endpoint

import requests

API_KEY = 'YOUTUBE_API_KEY'
VIDEO_ID = 'uH-ffKIgb38'

url = f'https://www.googleapis.com/youtube/v3/videos?id={VIDEO_ID}&key={API_KEY}&part=snippet,contentDetails,statistics'
response = requests.get(url)

if response.status_code == 200:
    video_data = response.json()
else:
    print(f'Error: {response.status_code}')

Outerbase Command

After testing the API, it is time to write your Outerbase Command function.

async function userCode() {

    var videoid = {{request.query.videoid}}

    if (!videoid) {
        return {
            status: 400,
            error: "missing video id"
        }
    }


    const apiUrl = "https://www.googleapis.com/youtube/v3/videos?id="+ videoid +"&key=AIzaSyDIPxAnxEoj_fbrV3d0FIvN0ictQ4n92Yo&part=snippet,contentDetails,statistics";

    const response = await fetch(apiUrl, {
        method: "GET"
    });

return response.json()

}

YouTube Video Infoviewer Streamlit app

For the quick POC, I have developed a Streamlit App that does the functionality of fetching Youtube video descriptions, stats & other details.

Below are the screenshots that explain about the App and its functionality

https://youtube-video-info-viewer.streamlit.app

Please find the attached link to the demo video here & Github Repository link here

Conclusion

Integration of Youtube as Outerbase command will help you understand the stats and information of the particular youtube video. Please let me know if you have any questions.

A big thank you for taking the time to read my article and shoutout to the outerbase & hashnode team for hosting this amazing hackathon. Please support me by liking the article and sharing the article if you like it, and follow me for more related articles.

#outerbase #outerbasehackathon #hashnode

Did you find this article valuable?

Support Balaji Seetharaman by becoming a sponsor. Any amount is appreciated!

ย