php - YouTube API订阅者数未更新

标签 php youtube youtube-api

我已经通过视频解释了这个问题,请在此处查看视频:

Strange Problem About Youtube API

我对youtube API有一个奇怪的问题。例如

http://gdata.youtube.com/feeds/api/users/tryingtobesikh

以上api返回的订阅者人数。但是当有人订阅时,刷新后不会立即更新。但是奇怪的是,当我同时按两次f5(refresh)时,它会更新。不知道是什么问题,可能是某些缓存问题?我正在编写一个脚本,在该脚本中,我需要检查是否有人立即订阅。如果用户订阅,则执行此操作,如果没有执行其他操作。因此,我需要即时订阅者计数更改。
任何类型的帮助将不胜感激。

最佳答案

YouTube官方API文档确实指出,数据更新可能会有所延迟:
http://code.google.com/apis/youtube/2.0/reference.html#Overview:

Statistics, such as the number of times a video has been viewed or the number of comments available for a video, are typically updated within 30 minutes to two hours after the upload completes. However, this delay may be longer under heavy API server loads.

On an ongoing basis, statistics for a video are typically updated every 30 minutes to two hours. However, updates may occur less frequently under heavy server loads or for videos that are viewed very infrequently. In search feeds, updates to ratings and view counts could take as long as a couple of weeks for infrequently viewed videos.



附带说明;
我本人只使用过一次YouTube API,但是正如您所说,您需要检查某个用户是否订阅了另一个用户,也许您可​​以尝试研究 Activity 供稿API?因为其中包含有关最近订阅的信息:

https://developers.google.com/youtube/2.0/developers_guide_protocol_activity_feeds

关于php - YouTube API订阅者数未更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11409576/

相关文章:

php - 消除服务器端 View |优点缺点

php - 如何将变量传递给 Laravel 中的服务提供者?

javascript - JWPlayer No suitable players found 错误与 youtube 链接

javascript - Youtube 可以很好地与 Turbolinks 一起玩吗?

jquery - 检测是否将youtube视频嵌入到我的网页中

php - 在 wordpress 上显示分类描述

node.js - 当第一首歌曲流完成时如何修复 "Stream is not generating quickly enough"错误?

javascript - YouTube javascript API(带有 ASP)功能无法正常工作

javascript - 在javascript中从浏览器(客户端站点)中的url强制下载youtube视频

PHP 下拉框无法发布