我正在尝试使用 application-only authentication 从服务器端应用程序检索公共(public)推文(没有用户上下文)。
下面的代码工作正常:
var service = new TwitterService("<consumer key>", "<consumer secret>");
service.AuthenticateWith("<access token>", "<access token secret>");
var options = new ListTweetsOnUserTimelineOptions { ScreenName = "billgates" };
foreach (var tweet in service.ListTweetsOnUserTimeline(options))
Console.WriteLine(tweet.Text);
但是我从这张图中了解到,没有必要提供访问 token / secret :
但是,当我删除对 AuthenticateWith
的调用时,ListTweetsOnUserTimeline
返回 null。
这是图书馆的限制,如果不是,我该怎么办?
编辑
据我所知,这调用了 GET statuses/user_timeline
根据 documentation 应支持仅应用程序身份验证的方法:
API methods that support this form of authentication will contain two rate limits in their documentation, one that is per user (for application-user authentication) and the other is per app (for this form of application-only authentication)
GET statuses/user_timeline
方法在其文档中显示了这两个限制。
最佳答案
我认为这不是库的限制,而是 Twitter API 的限制。
据我所知,ListTweetsOnUserTimeline() 方法使用 statuses/user_timeline API 调用。
如您所见,此调用需要身份验证。
您可以尝试使用 Streaming API 获取状态。我在这里帮不了你,因为我只有用户流方面的经验,没有公开的经验。
此外,TweetSharp 在流方面存在一些问题,我不得不切换到 Linq2Twitter 库。
关于c# - 仅 Twitter API 应用程序身份验证(使用 TweetSharp),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15376570/