好きなYouTubeチャンネルが10チャンネルあり、各チャンネルの最新動画情報を知りたいです。現在、私はこのような10の異なる呼び出しを行っています:
http://gdata.youtube.com/feeds/api/users/USERNAME/uploads?v=2&alt=jsonc&start-index=1&max-results=1
バッチ リクエストを使用して、これらの 10 回の呼び出しを 1 回の呼び出しに置き換えたいと考えています。
私はこれを試しました:
String xml = "<feed xmlns='http://www.w3.org/2005/Atom' xmlns:batch='http://schemas.google.com/gdata/batch'>" +
" <batch:operation type='query'/>" +
" <entry>" +
" <id>http://gdata.youtube.com/feeds/api/videos/VIDEO_ID_1</id>" +
" </entry>" +
" <entry>" +
" <id>http://gdata.youtube.com/feeds/api/videos/VIDEO_ID_2</id>" +
" </entry>" +
...
" <entry>" +
" <id>http://gdata.youtube.com/feeds/api/videos/VIDEO_ID_10</id>" +
" </entry>" +
"</feed>";
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("https://gdata.youtube.com/feeds/api/videos/batch?v=2");
StringEntity se = new StringEntity(xml);
se.setContentType("text/xml");
httpPost.setEntity(se);
HttpResponse response = httpClient.execute(httpPost);
HTTPResponse オブジェクトに有用なデータを含む XML を取得しています。
しかし、最新の10本の動画情報を取得したい場合、videoIdがわかりません。
これを達成する方法を知っている人はいますか?