How To Retrieve A YouTube Video's Tags With YouTube V3 API?
Solution 1:
According to https://developers.google.com/youtube/v3/docs/videos/list it appears that the latest version of the YouTube API now returns tags:
https://www.googleapis.com/youtube/v3/videos?key={API-key}&fields=items(snippet(title,description,tags))&part=snippet&id={video_id}
Solution 2:
Unfortunately, at present you can only get videos with tags when you authenticate yourself as the owner of the channel. Searching for tags used to work, but is broken in the current V2 implementation.
Solution 3:
Following method to fetch YouTube title, description and tags
First of all create Google API key
https://console.cloud.google.com/home/dashboardgo to credentials - create API key
https://console.cloud.google.com/apis/credentials?folder=&organizationId=&project=enable YouTube API
https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=download postman software to POST data on google server YouTube API
https://www.googleapis.com/youtube/v3/videos?key=your-key&fields=items(snippet(title,description,tags))&part=snippet&id=youtube-id
Solution 4:
I retrived video tags like this in my javascript , you can see - here
function getYouTubeTags() {
var q = document.getElementById("query").value;
VID_REGEX = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/;
var vidid = q.match(VID_REGEX)[1];
var key = "...";
var newrequest = new XMLHttpRequest();
newrequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var data = JSON.parse(this.responseText).items[0].snippet;
// document.getElementById("keyword").innerHTML = data.tags;
document.getElementById("titlen").innerHTML = data.title;
var i;
var cell4 = document.getElementById('tgs');
for (i = 0; i < data.tags.length; i++) {
var element3 = document.createElement("input");
element3.type = "button";
element3.name = "add";
element3.value = data.tags[i];
element3.className = "btn btn-danger";
cell4.appendChild(element3);
/*to set Image*/
document.getElementById("myImg").src = "https://img.youtube.com/vi/" + vidid + "/hqdefault.jpg";
}
}
};
newrequest.open('GET', "https://www.googleapis.com/youtube/v3/videos?id=" + vidid + "&key=" + key + "&fields=items(snippet(title,description,tags))&part=snippet", true);
newrequest.send(); }
Post a Comment for "How To Retrieve A YouTube Video's Tags With YouTube V3 API?"