【问题标题】:API gives constant subscriber countAPI 提供恒定的订阅者数量
【发布时间】:2021-08-19 15:04:37
【问题描述】:

我正在尝试制作一个显示 youtube 频道的实时订阅者数量的网络应用程序。但它只显示一个常数。订阅者的数量在下次调用 API 时不会更新。 我已经编写了这个函数来获取潜艇。我也尝试了 ID,但仍然没有更新。帮帮我。

Javascript

function getsubscribers(username, element) {
      let url = `https://www.googleapis.com/youtube/v3/channels?key=${KEY}&forUsername=${username}&    part=statistics`;

      fetch(url)
        .then((res) => res.json())
        .then((data) => {
          element.innerText = data.items[0].statistics.subscriberCount;
        });
    }

【问题讨论】:

标签: youtube-api youtube-data-api


【解决方案1】:

YouTube 分析也有同样的问题。

这是因为 YouTube API 不是实时 API,数据接缝每天更新一次。

【讨论】:

    猜你喜欢
    • 2014-10-19
    • 2018-03-10
    • 2012-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多