Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get youtube video description with video id?

I am currently using the Javascript API by youtube to display a video on my web page however now I want to also retrieve the youtube description from the video id? How would I go about doing this?

I only want description and title:

ex:

"kind": "youtube#video",
"etag": etag,
"id": string,
"snippet": {
"publishedAt": datetime,
"channelId": string,
"title": string,
"description": string,
"thumbnails": {
  (key): {
    "url": string,
    "width": unsigned integer,
    "height": unsigned integer
  }

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

If anyone could post a link or either show me an example of code on how I can accomplish this?

like image 544
ChewyMasta Avatar asked Jan 09 '23 09:01

ChewyMasta


1 Answers

The developer documentation you linked to has some excellent code examples -- that'll be the best place to start. Use the "list" reference menu for videos.

If you're saying that you just want the title and description without the other fields, you can use the fields parameter in your request ... something like this:

https://www.googleapis.com/youtube/v3/videos?part=snippet&id={VIDEO_ID}&fields=items/snippet/title,items/snippet/description&key={YOUR_API_KEY}
like image 137
jlmcdonald Avatar answered Jan 18 '23 07:01

jlmcdonald