【问题标题】:Retrieve and display YouTube video description, title by its id using YouTube API使用 YouTube API 检索并显示 YouTube 视频描述和标题
【发布时间】:2016-03-05 11:45:01
【问题描述】:

我想在页面上显示视频 youtube 的标题和描述,我知道如何使用这个 php 代码来计算计数

<?php
$JSON = file_get_contents("https://www.googleapis.com/youtube/v3/videos?
part=statistics&id=videoID&key=APIKey");
$json_data = json_decode($JSON, true);
echo $json_data['items'][0]['statistics']['viewCount'];
?>

但我不知道这是如何显示视频标题和描述的。

【问题讨论】:

标签: php json youtube-api


【解决方案1】:
<?php
$JSON = file_get_contents("https://www.googleapis.com/youtube/v3/videos?
part=snippet&id=videoID&key=APIKey");
$json_data = json_decode($JSON, true);
echo $json_data['items'][0]['snippet']['title'];
echo $json_data['items'][0]['snippet']['description'];
?>

【讨论】:

    猜你喜欢
    • 2012-05-27
    • 1970-01-01
    • 2014-02-09
    • 2021-05-28
    • 2020-04-24
    • 2015-05-14
    • 2014-09-02
    • 2013-07-18
    • 1970-01-01
    相关资源
    最近更新 更多