Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve a YouTube video's tags with YouTube v3 API?

I want to retrieve the tags for a specific YouTube video using v3 of the YouTube API.

I'm able to retrieve a video with this request to the search endpoint, https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=cats&type=video&key={YOUR_API_KEY}.

Now I hit the video endpoint trying to get the tags for the video from the above query. https://www.googleapis.com/youtube/v3/videos?id=IytNBm8WA1c&part=snippet&key={YOUR_API_KEY}

Response,

{
 "kind": "youtube#videoListResponse",
 "etag": "\"PMn2rAVTRiZHkX45qiqfcLZoTXM/rYBuk4KeZFmSMoiSuaXfy6-Pm28\"",
 "items": [
  {

   "id": "IytNBm8WA1c",
   "kind": "youtube#video",
   "etag": "\"PMn2rAVTRiZHkX45qiqfcLZoTXM/_6K6Qz8rLYf0d5gUnucV1LwbwU4\"",
   "snippet": {
    "publishedAt": "2007-07-09T14:02:03.000Z",
    "channelId": "UCFMV3DqmnaRc4oNGvi-3OvQ",
    "title": "Funny Cats",
    "description": "it's soo funny :D\r\n\r\naudio content is licensed by UMG\r\n\r\nSong 1: Gioachino Rossini - The Thieving Magpie  0:00 - 1:37\r\nSong 2: The Presidents of the United States of America - Kitty  1:38 - 2:47\r\nSong 3: The Nutcracker  2:48 - 3:51\r\nSong 4: Smash Mouth - All Star  3:51 - 7:06\r\nSong 5: The Wiseguys - Ooh La La  7:07 - 7:43\r\n\r\nPS: i will ignore messages with the subject\r\n\"Business Proposal Regarding Your YouTube Videos\"",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/IytNBm8WA1c/default.jpg"
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/IytNBm8WA1c/mqdefault.jpg"
     },
     "high": {
      "url": "https://i.ytimg.com/vi/IytNBm8WA1c/hqdefault.jpg"
     }
    },
    "channelTitle": "nguoap",
    "categoryId": "15"
   }
  }
 ]
}

API Explorer for this request - https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?id=IytNBm8WA1c&part=snippet&_h=3&

Even if I authorize this request I get the same results. Although, if the account being authorized owns the video it returns the tags.

How can I get the tags for the videos I own without asking the end-user to authorize their accounts? This implementation is client side with JS.

UPDATE: GData Issue Link: https://code.google.com/p/gdata-issues/issues/detail?id=4513

like image 373
KRB Avatar asked Apr 26 '13 15:04

KRB


3 Answers

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}
like image 178
Stephen Lead Avatar answered Sep 22 '22 12:09

Stephen Lead


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.

like image 32
R Keppel Avatar answered Sep 18 '22 12:09

R Keppel


Following method to fetch YouTube title, description and tags

  1. First of all create Google API key
    https://console.cloud.google.com/home/dashboard

  2. go to credentials - create API key
    https://console.cloud.google.com/apis/credentials?folder=&organizationId=&project=

  3. enable YouTube API
    https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=

  4. 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

like image 29
Vinod Joshi Avatar answered Sep 19 '22 12:09

Vinod Joshi