1

我看到在短时间内向播放列表添加多个条目似乎经常失败而没有任何错误响应的问题。

我使用 json-c 格式和 2.1 版的 api。如果我发送 POST 请求以将 7 个视频条目添加到播放列表,那么我会看到其中 3-5 个视频条目实际添加到播放列表的结果。我正在从 api 获取所有请求的 201 创建响应。

请求如下所示:

{"data":{"position":0,"video":{"duration":0,"id":"5gYXlTe0JTk","itemsPerPage":0,"rating":0,"startIndex":0,"totalItems":0}}}

and here's the response:

{"apiVersion":"2.1","data":{"id":"PLL_faWZNDjUU42ieNrViacdvqvG714P4QjvSDgGRg1kc","position":4,"author":"Lance Andersen","video":{"id":"5gYXlTe0JTk","uploaded":"2012-08-16T19:27:19.000Z","updated":"2012-09-28T20:20:39.000Z","uploader":"usanahealthsciences","category":"Education","title":"What other products does USANA offer?","description":"Discover USANA's other high-quality products: the Sens skin and hair care line, USANA Foods, the RESET weight-management program, and Rev3 Energy.","thumbnail":{"sqDefault":"http://i.ytimg.com/vi/5gYXlTe0JTk/default.jpg","hqDefault":"http://i.ytimg.com/vi/5gYXlTe0JTk/hqdefault.jpg"},"player":{"default":"http://www.youtube.com/watch?v=5gYXlTe0JTk&feature=youtube_gdata_player","mobile":"http://m.youtube.com/details?v=5gYXlTe0JTk"},"content":{"5":"http://www.youtube.com/v/5gYXlTe0JTk?version=3&f=playlists&d=Af8Xujyi4mT-Oo3oyndWLP8O88HsQjpE1a8d1GxQnGDm&app=youtube_gdata","1":"rtsp://v6.cache3.c.youtube.com/CkgLENy73wIaPwk5JbQ3lRcG5hMYDSANFEgGUglwbGF5bGlzdHNyIQH_F7o8ouJk_jqN6Mp3Viz_DvPB7EI6RNWvHdRsUJxg5gw=/0/0/0/video.3gp","6":"rtsp://v7.cache7.c.youtube.com/CkgLENy73wIaPwk5JbQ3lRcG5hMYESARFEgGUglwbGF5bGlzdHNyIQH_F7o8ouJk_jqN6Mp3Viz_DvPB7EI6RNWvHdRsUJxg5gw=/0/0/0/video.3gp"},"duration":72,"aspectRatio":"widescreen","rating":5.0,"likeCount":"6","ratingCount":6,"viewCount":1983,"favoriteCount":0,"commentCount":0,"accessControl":{"comment":"allowed","commentVote":"allowed","videoRespond":"moderated","rate":"allowed","embed":"allowed","list":"allowed","autoPlay":"allowed","syndicate":"allowed"}},"canEdit":true}}

如果我设置位置属性,问题不会改变。

如果我按顺序发送它们,它们之间有 5 秒的延迟,那么结果会更可靠,通常 7 个中有 6 个会出现在播放列表中。似乎在 api 服务器端发生了竞争情况。
我不确定如何处理这个问题,因为我在 api 调用响应中看到零错误。

我考虑过进行批处理,但找不到任何关于 json-c 格式的文档。我不确定这是否会有所作为。

是否有可靠地将播放列表条目添加到播放列表的解决方案?

4

1 回答 1

0

这已在 10 月 25 日左右修复并更新到 youtube 数据 API。

于 2013-01-23T17:44:18.587 回答