2016-08-04 78 views
1

我正在爲特定研究目的提取大量的YouTube評論。隨着評論,我可以提取作者的顯示名稱,但是當我嘗試提取作者的谷歌加個人資料URL時,它將爲超過10,000條評論的所有作者返回null!我究竟做錯了什麼?有沒有其他方式可以將YouTube評論者鏈接到Google +個人資料?YouTube數據API(Java)CommentSnippet.getAuthorGoogleplusProfileUrl()返回null

if(!snippet.isEmpty()) 
{ 
    pw.println(" - Author: " + snippet.getAuthorDisplayName());//works fine 
    pw.println(" - Comment: " + snippet.getTextDisplay()); //works fine 
    //the following line always returns null! 
    pw.println(" - Google+ Profile URL: " + snippet.getAuthorGoogleplusProfileUrl()); //always returns null 
    pw.println(" - Author Channel ID: " + snippet.getAuthorChannelId()); //works fine 
    pw.println(" - Author Channel URL: " + snippet.getAuthorChannelUrl());//works fine 
    pw.println("\n-------------------------------------------------\n"); 
} 
//pw: a PrintWriter object 
//snippet: a CommentSnippet object 

請幫忙!我絕對堅持在這... 關心。

+0

嘗試使用getAuthorGoogleplusProfileUrl檢查至少一個用戶嗎?檢查你是否執行不正確。檢查[文檔](https://developers.google.com/resources/api-library/documentation/youtube/v3/java/latest/com/google/api/services/youtube/model/CommentSnippet.html#getAuthorGoogleplusProfileUrl( ))'getAuthorGoogleplusProfileUrl'返回一個值,或者返回null。希望能幫助到你! –

+0

感謝@Rebot先生的回覆。我一次又一次地檢查,但無法弄清楚問題所在。我也閱讀了文檔。您能否建議通過其他方式將YouTube評論者與Google+個人資料相關聯?問候。 – Syed

回答