php - 如何从 youtube google api 访问 youtube json 日期?

标签 php json youtube

如何从 youtube google 的 Youtube api 访问横幅图像的 url、 channel 标题、订阅者数量和默认 Logo 图像 url?

一个 example of the JSON api can be found here .

如何使用 PHP 访问这些内容?

最佳答案

以这种方式进行:

$youtube = file_get_contents("https://www.googleapis.com/youtube/v3/channels?part=snippet,brandingSettings&id=UCyoUx3RguJRgbaMo07yc_KA&key=AIzaSyCZonTWlCv92Nd93j5CuFFcqGciLIe5rx4");

$data = json_decode($youtube,true);

echo "BANNER IMAGE URL: ".$data['items'][0]['brandingSettings']['image']['bannerImageUrl']."<br>";
echo "CHANNEL TITLE: ".$data['items'][0]['brandingSettings']['channel']['title']."<br>";

等等....

this tools查看json的结构并提取您需要的内容非常好

关于php - 如何从 youtube google api 访问 youtube json 日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33866489/

相关文章:

php mysql 如果 varchar 不为空

php - codeigniter:如何从指定索引转换数组值?

mysql - jQuery 自动完成 : pre-cache query to increase performance?

youtube-dl 给了我一个关于 ssl 的错误

php - 如何计算 MySQL 查询的大小?

javascript - 在 Laravel 中将 JSON 从 Controller 传输到 AngularJS

javascript - 如何从 JSON 中统计具体的值

android - android 4.3中无法通过action_send Intent上传视频

php - Wordpress中的PHP函数不显示嵌入式YouTube视频

php - 根据条件从已解析的 HTML 文档中删除 HTML 元素