2013-08-27 33 views
1

我想在從YouTube上檢索視頻評論時更改最大結果。這是我的代碼:com.google.gdata.util.InvalidEntryException當max-results在URL中時

YouTubeService service = new YouTubeService(
      "CLIENT_ID"); 
    String str="http://gdata.youtube.com/feeds/api/videos/"+videoId; 
    YouTubeQuery youtubeQuery = new YouTubeQuery(new URL(
      str)); 

    youtubeQuery.setMaxResults(50); 
    youtubeQuery.setStartIndex(1); 
    String videoEntryUrl = youtubeQuery.getUrl().toString(); 
    System.out.println(videoEntryUrl+" *************"); 
    VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), 
       VideoEntry.class); 

在創建最後一排的VideoEntry對象,它給出了這樣的錯誤:在線程「主要」 com.google.gdata.util.InvalidEntryException

例外:'最大結果參數不支持此資源 http://schemas.google.com/g/2005'>GData unsupportedQueryParam的‘最大結果’參數不支持此資源

我的代碼當它打印查詢時,艾夫斯錯誤查詢是這樣的:

http://gdata.youtube.com/feeds/api/videos/v_wzBsZLLaE?start-index=1&max-results=40

爲什麼max-results參數在這種情況下,不支持?

問候

回答

1

您正在請求關於一個視頻的視頻信息。因此,對於1個視頻,使用start-index和max-results沒有任何意義。 (如果允許,那麼兩者只能是1.)

相關問題