Get comment or likes count for YouTube video using API 3.0(使用 API 3.0 获取 YouTube 视频的评论或点赞数)
问题描述
我想获得具有特定 YouTube ID 的视频的评论和/或喜欢的数量.我正在使用 YouTube API v3.0.
I want to get number of comments and/or likes for video with specific YouTube ID. I am using YouTube API v3.0.
我正在搜索 API 文档,但找不到合适的方法.
I was searching through API documentation and can't find appropriate method.
推荐答案
在仔细查看 Google API 文档后 这里,我发现我可以使用 Videos.List API 的statistics"部分参数来得到我想要的.
After having better look at Google API documentation here, I have found that I can use "statistics" part parameter of Videos.List API in order to get what I want.
确切的 HTTP 发布请求应该是(注意 part=statistics 参数):
Exact HTTP post request should be (notice part=statistics parameter):
GET https://www.googleapis.com/youtube/v3/videos?part=statistics&id=sTPtBvcYkO8&key={YOUR_API_KEY}
响应是:
{
"kind": "youtube#videoListResponse",
"etag": ""kjEFmP90GvrCl8BObMQtGoRfgaQ/XN5YXMZGQaruwTWTekZu7fQthdY"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": ""kjEFmP90GvrCl8BObMQtGoRfgaQ/QbzZs_aBNpzkZJxTVM7YgQeEY3g"",
"id": "sTPtBvcYkO8",
"statistics": {
"viewCount": "3215321",
"likeCount": "17003",
"dislikeCount": "263",
"favoriteCount": "0",
"commentCount": "621"
}
}
]
}
这篇关于使用 API 3.0 获取 YouTube 视频的评论或点赞数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 API 3.0 获取 YouTube 视频的评论或点赞数
基础教程推荐
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- WPF 模态进度窗口 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
