Fetch YouTube Title from YouTube video Id

JavaScript Dec 09, 2015

Following post explains you fetching Youtube title from Youtube Id

Example youtube Id of given url https://www.youtube.com/watch?v=YQHsXMglC9A which will be ==YQHsXMglC9A ==

$.getJSON( "https://www.googleapis.com/youtube/v3/videos?part=id%2Csnippet&id=<<youtubeId>>&key=<<API KEY of google console app>>", function( data ) {
   //var obj = $.parseJSON(data);
    console.log(data.items[0].snippet.localized.title);
});

Post Explained

So what we are doing here?

Here we are doing asynchronous ajax call to YouTube API to fetch video details using jQuery, remember that we are printing/Console.log of YouTube title, In order to fetch more information look at JSON response and work accordingly

NOTE If you need any help in setting up API keys click here

Phanindra Mangipudi

Salesforce, Lightning Web Componets, Node.Js, Angular 2+, Bootstrap