Juribiyan
Juribiyan

Reputation: 740

Given the video ID, how to get it's title using YouTube Data API v.3

In my project I generate custom wrappers for youtube video embeds on the client side. I used to get video titles by parsing xml responses from http://gdata.youtube.com/feeds/api/videos/VIDEO_ID. Recently Youtube changed the title field for every video with "https://youtube.com/devicesupport" indicating deprecation of Data API v.2. I went to v.3 documentation and got confused. It was talking about authorization credentials, registering a project in the developers console, etc. Is it really necessary to just get a video's title?

Upvotes: 4

Views: 2450

Answers (2)

Jose Echavez
Jose Echavez

Reputation: 56

Only need a apikey of you application and videoID:

GET https://www.googleapis.com/youtube/v3/videos?part=id%2Csnippet&id={video_id}&key={YOUR_API_KEY}

Upvotes: 2

Ethan
Ethan

Reputation: 87

https://developers.google.com/youtube/v3/docs/videos/list

Set the part parameter to snippet and id to the ID of the video. For example, with the ID jofNR_WkoCE, you will get:

{
 ...
 "items": [
  {
   ...
   "snippet": {
    ...
    "title": "Ylvis - The Fox (What Does The Fox Say?) [Official music video HD]",
    ...
   }
  }
 ]
}

Upvotes: 1

Related Questions