Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
96
rated 0 times [  99] [ 3]  / answers: 1 / hits: 93648  / 12 Years ago, sun, april 8, 2012, 12:00:00

So I am trying to get information from a single youtube video via in the JSON format. Like title description category, ect whatever I can get besides the comments. I am trying to do this in Javascript. I noticed the link below but all of their examples are how to get video information from feeds. I would like to get the information from a single video assuming i know its ID.



https://developers.google.com/youtube/2.0/developers_guide_json



I was also looking at this Stackoverflow Question but I have an issue with the get request it says
test.js (line 10)
GET http://gdata.youtube.com/feeds/api/videos/VA770w...v=2&alt=json-in-script&callback=listInfo



200 OK
9ms



In brief, if i have a single youtube videos id like VA770wpLX-Q, what would the url look like to get that videos information in JSON?



Thank you


More From » jquery

 Answers
14

UPDATE MAY/2015:



This solution doesn't work properly, YouTube API v2 is in process to be discontinued soon.



More info at:
https://www.youtube.com/devicesupport






Try something like this:



var video_id='VA770wpLX-Q';

$.getJSON('http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc',function(data,status,xhr){
alert(data.data.title);
// data contains the JSON-Object below
});


Demo: http://jsfiddle.net/wqwxg/



The returned JSON looks like this:



{
apiVersion: 2.1,
data: {
id: VA770wpLX-Q,
uploaded: 2011-02-24T22:31:02.000Z,
updated: 2012-04-08T21:37:06.000Z,
uploader: drdrevevo,
category: Music,
title: Dr. Dre - I Need A Doctor (Explicit) ft. Eminem, Skylar Grey,
description: Music video by Dr. Dre performing I Need A Doctor featuring Eminem and Skylar Grey (Explicit). © 2011 Aftermath Records,
tags: [Dr, Dre, Eminem, New, Song, Skylar, Grey, GRAMMYs, Dr., Need, Doctor, video, Eazy, N.W.A., NWA, easy, drdre, and, em],
thumbnail: {
sqDefault: http://i.ytimg.com/vi/VA770wpLX-Q/default.jpg,
hqDefault: http://i.ytimg.com/vi/VA770wpLX-Q/hqdefault.jpg
},
player: {
default: http://www.youtube.com/watch?v=VA770wpLX-Q&feature=youtube_gdata_player
},
content: {
5: http://www.youtube.com/v/VA770wpLX-Q?version=3&f=videos&app=youtube_gdata
},
duration: 457,
aspectRatio: widescreen,
rating: 4.902695,
likeCount: 430519,
ratingCount: 441253,
viewCount: 88270796,
favoriteCount: 306556,
commentCount: 270597,
status: {
value: restricted,
reason: requesterRegion
},
restrictions: [{
type: country,
relationship: deny,
countries: DE
}],
accessControl: {
comment: allowed,
commentVote: allowed,
videoRespond: allowed,
rate: allowed,
embed: allowed,
list: allowed,
autoPlay: denied,
syndicate: allowed
}
}
}

[#86366] Friday, April 6, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
darennevina

Total Points: 422
Total Questions: 128
Total Answers: 105

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
;