How to get video tags from youtube video?

Hi I want to get tags of video from youtube video url, I have searched in google but mostly I get answer that "YouTube's API can no longer be used to retrieve tags".

So is there any way that I can get video tags from youtube video using php or any api?


For example for URL : http://www.youtube.com/watch?v=LIjs3-8cZVA

$connect = file_get_contents("http://www.youtube.com/watch?v=LIjs3-8cZVA");
preg_match_all('|<meta property="og:video:tag" content="(.+?)">|si', $connect, $tags, PREG_SET_ORDER);
foreach ($tags as $tag) {
    echo $tag[1] . "<br>";
}

I hope it helps.


你也可以试试

$meta = get_meta_tags( "http://www.youtube.com/watch?v=LIjs3-8cZVA" );
$tags = isset( $meta['keywords'] ) ? $meta['keywords'] : '';

You can use videos.list API method for tags, instead of downloading the whole content.

Here's a PHP sample: https://github.com/youtube/api-samples/blob/master/php/update_video.php#L73

链接地址: http://www.djcxy.com/p/4936.html

上一篇: 在PowerShell中获取文件版本

下一篇: 如何从YouTube视频获取视频标签?