How to get youtube video keywords using php
I am trying to get keywords for a video using the video id (or url).
I searched for it and found ways to get the video information (title, length, etc.), but couldn't find a way to get the keywords. So ... how to get youtube video keywords with php
code:
$entry = simplexml_load_file('http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2');
$keywords = (string) $entry->children('media', TRUE)->group->keywords;
$keywords_array = explode(", ", $keywords);
print_r($keywords_array);
+3
source to share
2 answers
For this, you need the YouTube API .
which you will be looking for:
snippet.tags[]
https://developers.google.com/youtube/v3/docs/videos#properties
Get your credentials in the Google API Console
Example request:
https://www.googleapis.com/youtube/v3/videos?part=snippet&id=Lg7vPFnTuMg&order=date&key=YOURKEY
+1
source to share