Youtube 我需要在我的查询中获得100多页

Youtube 我需要在我的查询中获得100多页,youtube,youtube-api,Youtube,Youtube Api,我想为我的项目从Youtube上获取所有可能的视频信息。我知道限制页是100页 我执行下一个代码: ArrayList<String> videos = new ArrayList<>(); int i = 1; String peticion = "http://gdata.youtube.com/feeds/api/videos?category=Comedy&alt=json&max-resul

我想为我的项目从Youtube上获取所有可能的视频信息。我知道限制页是100页

我执行下一个代码:

         ArrayList<String> videos  = new ArrayList<>();
         int i = 1;
         String peticion = "http://gdata.youtube.com/feeds/api/videos?category=Comedy&alt=json&max-results=50&page=" + i;
         URL oracle = new URL(peticion);
             URLConnection yc = oracle.openConnection();
             BufferedReader in = new BufferedReader(new InputStreamReader(
                                         yc.getInputStream()));
             String inputLine = in.readLine();
             while (in.readLine() != null) 
             {
                 inputLine = inputLine + in.readLine();
             }

             System.out.println(inputLine);

             JSONObject jsonObj = new JSONObject(inputLine);
             JSONObject jsonFeed = jsonObj.getJSONObject("feed");
             JSONArray jsonArr = jsonFeed.getJSONArray("entry");

             while(i<=100)
             {
                 for (int j = 0; j < jsonArr.length(); j++) {
                     videos.add(jsonArr.getJSONObject(j).getJSONObject("id").getString("$t"));
                     System.out.println("Numero " + videosTotales + jsonArr.getJSONObject(j).getJSONObject("id").getString("$t"));
                     videosTotales++;
                 }
                 i++;
             }
ArrayList视频=新建ArrayList();
int i=1;
字符串peticion=”http://gdata.youtube.com/feeds/api/videos?category=Comedy&alt=json&max-结果=50&page=“+i;
URL oracle=新URL(小标题);
URLConnection yc=oracle.openConnection();
BufferedReader in=新的BufferedReader(新的InputStreamReader(
yc.getInputStream());
字符串inputLine=in.readLine();
while(in.readLine()!=null)
{
inputLine=inputLine+in.readLine();
}
系统输出打印LN(输入线);
JSONObject jsonObj=新的JSONObject(inputLine);
JSONObject jsonFeed=jsonObj.getJSONObject(“feed”);
JSONArray jsonArr=jsonFeed.getJSONArray(“条目”);

而(i这5000个id也是唯一的吗? 我看到了max results=50的用法,但不是url中的开始索引参数。 每个请求可以获得的结果有一个限制。在某个时间间隔内可以发送的请求数量也有一个限制。通过检查响应的状态代码和任何错误消息,您可以找到这些限制,因为它们可能会随时间而变化

除了category参数外,还可以使用其他一些参数。例如,您可以更改q参数(与某些关键字一起使用)和/或order参数以获得不同的结果集。 有关可用参数,请参阅文档

请注意,您使用的是已弃用的api版本2。有一个api版本3