Twitter API仅应用程序身份验证(使用TweetSharp)

时间:2013-03-13 03:31:55

标签: c# twitter tweetsharp

我正在尝试使用application-only authentication(无用户上下文)从服务器端应用程序检索公共推文。

以下代码可以正常使用:

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);

但是,我从这个图中收集到,没有必要提供访问令牌/秘密:

Application-only authentication

但是,当我删除对AuthenticateWith的调用时,ListTweetsOnUserTimeline将返回null。

这是图书馆的限制,如果没有,我该怎么办?

修改

据我所知,根据GET statuses/user_timeline,这会调用应支持仅应用程序身份验证的documentation方法:

  

支持这种形式的身份验证的API方法将在其文档中包含两个速率限制,一个是每个用户(用于应用程序用户身份验证),另一个是每个应用程序(用于此形式的仅应用程序身份验证)

GET statuses/user_timeline方法在其文档中显示了这两个限制。

2 个答案:

答案 0 :(得分:1)

我认为这不是对图书馆的限制,而是对Twitter API的限制。

据我所知,ListTweetsOnUserTimeline()方法使用statuses / user_timeline API调用。

GET statuses/user_timeline

如您所见,此调用需要身份验证。

您可以尝试使用Streaming API获取状态。我无法帮助你,因为我只有使用用户流的经验,而不是公开。

Public streams

此外,TweetSharp对流有一些问题,我不得不切换到Linq2Twitter库。

答案 1 :(得分:1)

确认不支持: https://github.com/danielcrenna/tweetsharp/issues/80#issuecomment-19862455

由于该项目已退役,因此无法为其添加支持。