Michael Phelps
Michael Phelps

Reputation: 3591

Youtube Api response fo video title string "https://youtube.com/devicesupport"

For all videos youtube Api response :

    $.getJSON( 'http://gdata.youtube.com/feeds/api/videos/'+videoID+'?v=2&alt=jsonc',
 function(data){
    var videoTitle = data.data.title; 
//"https://youtube.com/devicesupport"
            });

Youtube changed API ?

Append YouTube embedded video title

Getting a Youtube video title using AngularJS

jssfiddle http://plnkr.co/edit/ElWctwROCR9wdJB4KEIB?p=preview

UPD YOUTUBE API v3:

$.getJSON('http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?alt=json',function(data,status,xhr){
    console.log(data.entry.title.$t);
}); 

but data.entry.title.$t = "https://youtube.com/devicesupport"

Upvotes: 1

Views: 923

Answers (1)

Tony
Tony

Reputation: 2483

Your request string is using v=2 and version 2 is deprecated.

Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information. Please use the YouTube Data API (v3) for new integrations and migrate applications still using the v2 API to the v3 API as well.

See their migration guide.

It looks like you want your URL to be, source:

https://www.googleapis.com/youtube/v3/videos?part=snippet&id=gzDS-Kfd5XQ&key={YOUR_API_KEY}

See also: Youtube API v3 search for videos, retrieve title and url

Upvotes: 1

Related Questions