gpt4 book ai didi

json - 如何在 php 中读取 youtube 数据 api v3 响应

转载 作者:行者123 更新时间:2023-12-01 14:59:32 25 4
gpt4 key购买 nike

我有以下代码:

$yt_profiles = $youtube->channels->listChannels('brandingSettings', array(
'mine' => 'true',
));

返回以下输出:

Google_Service_YouTube_ChannelListResponse Object
(
[collection_key:protected] => items
[etag] => "WFPuK6TsnblcGPcnMex79s42ynQ/sTnuE1bHO-tokx_mFFDt1ybN90g"
[eventId] =>
[itemsType:protected] => Google_Service_YouTube_Channel
[itemsDataType:protected] => array
[kind] => youtube#channelListResponse
[nextPageToken] =>
[pageInfoType:protected] => Google_Service_YouTube_PageInfo
[pageInfoDataType:protected] =>
[prevPageToken] =>
[tokenPaginationType:protected] => Google_Service_YouTube_TokenPagination
[tokenPaginationDataType:protected] =>
[visitorId] =>
[modelData:protected] => Array
(
[pageInfo] => Array
(
[totalResults] => 1
[resultsPerPage] => 1
)

[items] => Array
(
[0] => Array
(
[kind] => youtube#channel
[etag] => "WFPuK6TsnblcGPcnMex79s42ynQ/ecOcHFmWyWQ7ToCD7-B1L36b4L4"
[id] => UCQO6uXy5maTpYvSa_yM--Bw
[brandingSettings] => Array
(
[channel] => Array
(
[title] => Vasim Padhiyar
[showRelatedChannels] => 1
[featuredChannelsTitle] => Featured Channels
[featuredChannelsUrls] => Array
(
[0] => UCw-TnDmYDQyjnZ5qpVWUsSA
)

[profileColor] => #000000
)

[image] => Array
(
[bannerImageUrl] => http://s.ytimg.com/yts/img/channels/c4/default_banner-vfl7DRgTn.png
)

[hints] => Array
(
[0] => Array
(
[property] => channel.featured_tab.template.string
[value] => Everything
)

[1] => Array
(
[property] => channel.banner.image_height.int
[value] => 0
)

[2] => Array
(
[property] => channel.modules.show_comments.bool
[value] => True
)

)

)

)

)

)

[processed:protected] => Array
(
)

)

我想遍历 modelData:protected 变量以获取 channel 列表及其项目数据。它的 json 对象所以 $yt_profiles->modelData:protected 在访问时不起作用。请帮我解决这个问题。提前致谢

最佳答案

您可以像在数组中一样访问它:

print_r ($yt_profiles['modelData']);

关于json - 如何在 php 中读取 youtube 数据 api v3 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25698470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com