2016-08-04 98 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

回答