duanhe4267 2014-09-23 19:51
浏览 31
已采纳

Youtube gdata卷曲错误

By Using curl and json decode. I'm able to get the list of all youtube videos of a user. It works perfectly. Curl return NULL when server is busy. Please suggest me any solution for this problem

$curl = curl_init();
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
 curl_setopt($curl, CURLOPT_TIMEOUT, 60);
 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($curl, CURLOPT_URL, 'http://gdata.youtube.com/feeds/api/users/USERNAME/uploads?v=2&alt=jsonc&max-results=30);
 $output = curl_exec($curl);
 curl_close($curl);
 $json = json_decode($output,true);

This is the code i'm using to get videos. It is returning NULL when server is Busy.

  • 写回答

1条回答 默认 最新

  • dqqt31923 2014-09-30 18:08
    关注

    I suggest you should use developer key within your API call. Because i think this issue could be related to YouTube API quota error. You can get more information from this blog. You should pay attention to these quoted text:

    The new quota system ties usage to a specific developer key; as long as your application includes a developer key along with your YouTube API requests, your requests will be less likely to be flagged for quota violations.
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀