如何使用TweetSharp获取Twitter状态和回复

时间:2022-09-08 09:46:38

I'm trying to get all Tweets tweeted by me with replies (if any). I'm using TweetSharp and I'm able to get my own tweets but couldn't figure out how to get the replies as well in the same request/response.

我想通过回复(如果有的话)让我发推文推特。我正在使用TweetSharp,我能够得到自己的推文,但无法弄清楚如何在同一请求/响应中获得回复。

Also, I'm able to get all replies/mentions by itself, but in a separate request which would make it very hard to link each reply with it's original Status.

此外,我能够自己获得所有回复/提及,但在单独的请求中,很难将每个回复与其原始状态链接起来。

I tried to use the "Exclude Replies" property but it's not making any difference in the response:

我尝试使用“排除回复”属性,但它在响应中没有任何区别:

TimelineTweetsOptions.ExcludeReplies = true; 

Any ideas how I can achieve this? even with using another library such as LinqToTwitter or anything else?

我有什么想法可以做到这一点?即使使用其他库,如LinqToTwitter或其他任何东西?

I'm coding with ASP.NET C# and TweetSharp v4.0.2

我正在编写ASP.NET C#和TweetSharp v4.0.2

Update #1: ExcludeReplies property works, but only for my own replies to other users.. I still can't get the status with all users' replies.

更新#1:ExcludeReplies属性有效,但仅适用于我自己对其他用户的回复..我仍然无法获得所有用户回复的状态。

Update #2: I understand I have to use some recursion methods to achieve this, any help?

更新#2:我知道我必须使用一些递归方法来实现这一点,任何帮助?

1 个解决方案

#1


0  

I found the answer of my own question, as @Yort said there's no easy way to do it by a single call.

我找到了自己问题的答案,因为@Yort说通过一次通话就没有简单的方法。

So my solution was to use InReplyToStatusId field and track it up until I reach a the root status (since I store all the statuses in my Database).

所以我的解决方案是使用InReplyToStatusId字段并跟踪它,直到我达到根状态(因为我将所有状态存储在我的数据库中)。

Ofcourse, I consider a status is a root by having InReplyToStatusId == 0 or in case it's a Retweet then I won't find the original Tweet in my Database then it's my root status and stop.

当然,我认为状态是一个根,通过让InReplyToStatusId == 0或者如果它是一个转推,那么我将无法找到我的数据库中的原始推文然后它是我的根状态并停止。

Store each status in a List, then order by date desc or asc.

将每个状态存储在List中,然后按日期desc或asc排序。

#1


0  

I found the answer of my own question, as @Yort said there's no easy way to do it by a single call.

我找到了自己问题的答案,因为@Yort说通过一次通话就没有简单的方法。

So my solution was to use InReplyToStatusId field and track it up until I reach a the root status (since I store all the statuses in my Database).

所以我的解决方案是使用InReplyToStatusId字段并跟踪它,直到我达到根状态(因为我将所有状态存储在我的数据库中)。

Ofcourse, I consider a status is a root by having InReplyToStatusId == 0 or in case it's a Retweet then I won't find the original Tweet in my Database then it's my root status and stop.

当然,我认为状态是一个根,通过让InReplyToStatusId == 0或者如果它是一个转推,那么我将无法找到我的数据库中的原始推文然后它是我的根状态并停止。

Store each status in a List, then order by date desc or asc.

将每个状态存储在List中,然后按日期desc或asc排序。