如何使用数据API获取YouTube频道统计信息(例如最近28天)?

问题描述 投票:0回答:2

我正在尝试获取过去 28 天的 YouTube 频道统计数据,例如

  1. 全视图
  2. 平均每日观看次数
  3. 频道国家
  4. 过去 28 天的浏览量
  5. 平均每日订阅者
  6. 列出项目

我得到了所有其他的东西,但这些没有。

目前我正在使用这个

https://www.googleapis.com/youtube/v3/videos?id=PBrEq9Wd6_U&key=[API_KEY]&part=snippet,contentDetails,statistics,status

并收到回复

{
  "kind": "youtube#videoListResponse",
  "etag": "xdV7ewWgCsOTS7cf0XUF8Fp9Xg4",
  "items": [
    {
      "kind": "youtube#video",
      "etag": "dZDlRrNH8pJOOeV8rPpuQcUaeKU",
      "id": "PBrEq9Wd6_U",
      "snippet": {
        "publishedAt": "2021-10-20T16:00:12Z",
        "channelId": "UC5DNytAJ6_FISueUfzZCVsw",
        "title": "Candy Crush in React",
        "description": "In this video I show you how to make a game of Candy Crush in React!\n\n00:00 Introduction\n01:37 Setting up our project\n07:25 Creating our Game Board\n24:48 Checking for matches\n42:46 Moving Candies down\n48:42 Dragging and Dropping in React\n01:07:20 Adding Images in React\n01:11:43 Adding the score\n01:17:25 Checking for blanks\n01:19:23 Suggestions for refactoring\n01:20:00 Where to go next? Saving High Scores (https://youtu.be/ARL0NuIQNjY)\n\nFinal code available here: https://github.com/kubowania/candy-crush-reactjs\nLearn how to add Game State in a database: https://youtu.be/ARL0NuIQNjY\n___\n⭐ Use promo code ANIAKUBOW for 3 months free of WebStorm IDE here (I get no commission from this link, but am in a partnership): https://jb.gg/get_webstorm\n\n⭐ New to code and none of this is making sense? Watch my '12hr+ YouTube Coding Bootcamp' in which you will learn HTML, CSS and JavaScript Fundamentals completely from scratch. It's on my channel and its 100% free.\n\n⭐ In most videos I use Tabnine as my A.I autocompletion tool. You can download it for free here (I get no commission from this link, but am in a partnership): ",
        "thumbnails": {
          "default": {
            "url": "https://i.ytimg.com/vi/PBrEq9Wd6_U/default.jpg",
            "width": 120,
            "height": 90
          },
          "medium": {
            "url": "https://i.ytimg.com/vi/PBrEq9Wd6_U/mqdefault.jpg",
            "width": 320,
            "height": 180
          },
          "high": {
            "url": "https://i.ytimg.com/vi/PBrEq9Wd6_U/hqdefault.jpg",
            "width": 480,
            "height": 360
          },
          "standard": {
            "url": "https://i.ytimg.com/vi/PBrEq9Wd6_U/sddefault.jpg",
            "width": 640,
            "height": 480
          },
          "maxres": {
            "url": "https://i.ytimg.com/vi/PBrEq9Wd6_U/maxresdefault.jpg",
            "width": 1280,
            "height": 720
          }
        },
        "channelTitle": "Code with Ania Kubów",
        "tags": [
          "candy crush",
          "react tutorial",
          "react game",
          "gamedev",
          "software engineering",
          "software development",
          "learn to code",
          "coding bootamp",
          "100daysOfcode",
          "javascript tutorial for beginners",
          "javascript tutorial",
          "react for beginners",
          "candy crush development"
        ],
        "categoryId": "27",
        "liveBroadcastContent": "none",
        "localized": {
          "title": "Candy Crush in React",
          "description": "In this video I show you how to make a game of Candy Crush in React!\n\n00:00 Introduction\n01:37 Setting up our project\n07:25 Creating our Game Board\n24:48 Checking for matches\n42:46 Moving Candies down\n48:42 Dragging and Dropping in React\n01:07:20 Adding Images in React\n01:11:43 Adding the score\n01:17:25 Checking for blanks\n01:19:23 Suggestions for refactoring\n01:20:00 Where to go next? Saving High Scores (https://youtu.be/ARL0NuIQNjY)\n\nFinal code available here: https://github.com/kubowania/candy-crush-reactjs\nLearn how to add Game State in a database: https://youtu.be/ARL0NuIQNjY\n___\n⭐ Use promo code ANIAKUBOW for 3 months free of WebStorm IDE here (I get no commission from this link, but am in a partnership): https://jb.gg/get_webstorm\n\n⭐ New to code and none of this is making sense? Watch my '12hr+ YouTube Coding Bootcamp' in which you will learn HTML, CSS and JavaScript Fundamentals completely from scratch. It's on my channel and its 100% free.\n\n⭐ In most videos I use Tabnine as my A.I autocompletion tool. You can download it for free here (I get no commission from this link, but am in a partnership):"
        },
        "defaultAudioLanguage": "en-GB"
      },
      "contentDetails": {
        "duration": "PT1H21M1S",
        "dimension": "2d",
        "definition": "hd",
        "caption": "false",
        "licensedContent": true,
        "contentRating": {},
        "projection": "rectangular"
      },
      "status": {
        "uploadStatus": "processed",
        "privacyStatus": "public",
        "license": "youtube",
        "embeddable": true,
        "publicStatsViewable": true,
        "madeForKids": false
      },
      "statistics": {
        "viewCount": "150594",
        "likeCount": "5017",
        "favoriteCount": "0",
        "commentCount": "232"
      }
    }
  ],
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 1
  }
}
youtube-api youtube-data-api
2个回答
3
投票

据我所知,您无法向 YouTube Data API v3 请求过去的数据。然而,通过定期从 YouTube 检索数据,您将来将能够获得这些统计数据。

  1. 总视图:使用频道:列表确保在
    statistics
    中包含
    part
  2. 平均每日观看次数:我让您在定期检索所需数据后进行数学计算。
  3. 频道国家:据我所知,频道国家/地区并未在所有 YouTube 频道上定义,但如果已定义,您可以使用
    Channels: list
    snippet part
  4. 中获取它
  5. 过去 28 天的观看次数:我让你算一下
  6. 平均每日订阅者:如果您在
    subscriberCount
    中使用 statistics,则可以使用
    Channels: list
    检索
    part
    。警告:众所周知,这个数字是由 YouTube 四舍五入的,据我所知,没有任何方法可以获得更准确的计数器
  7. 列表项:我不明白你的意思,你可以添加精度作为评论,我会编辑我的答案吗?您的意思是列出您的视频吗?

0
投票

您可以查看 YouTube Analytics API。您所寻求的内容将归入Metrics

此外,您还可以查看相关视频:https://www.youtube.com/watch?v=WtsS8sEzEeY

© www.soinside.com 2019 - 2024. All rights reserved.