简体   繁体   English

Twitterizer - C# 代码仅搜索我关注的用户的推文

[英]Twitterizer - C# Code to Search Tweets From Only Users I Follow

I am currently using Twitterizer to search through public tweets using C#:我目前正在使用 Twitterizer 使用 C# 搜索公共推文:

    private void QueryTwitter()
{
  SearchOptions myOptions = new SearchOptions();
  myOptions.CacheTimespan = new TimeSpan(0, 15, 0);
  //myOptions.ResultType = SearchOptionsResultType.Popular;
  string searchTerm = "\"" + Player.GetPlayer(this.PlayerID).FullName + "\"";
  TwitterResponse<TwitterSearchResultCollection> recentTweets = TwitterSearch.Search(searchTerm, myOptions);
  repTweets.DataSource = recentTweets.ResponseObject;
  repTweets.DataBind();
}

What I'd like to do is search through tweets from only the people that I follow.我想做的是只搜索我关注的人的推文。 Is there any way to do this?有没有办法做到这一点?

The search api is a non-authenticated endpoint, so it does not have any knowledge of who you are.搜索 api 是未经身份验证的端点,因此它不知道您是谁。 Because of this, there is no baked in way of filtering tweets to only show people that you follow.正因为如此,没有过滤推文以仅显示您关注的人的方式。

It is possible, however, to construct a query that specifies the author of tweets, if you add something like this to your query: (from:user1 OR from:user2 OR from:user3)但是,如果您在查询中添加类似这样的内容,则可以构造一个指定推文作者的查询:(from:user1 OR from:user2 OR from:user3)

For example, my query string would be: "stream (from:twitterapi OR from:sitestreams)"例如,我的查询字符串是:“stream (from:twitterapi OR from:sitestreams)”

Keep in mind that the search api has complexity limits, so you will not be able to request all of your followers in a single query.请记住,搜索 api 具有复杂性限制,因此您将无法在单个查询中请求所有关注者。 If I were to guess, I'd say you'll get no more than 5 users at a time.如果我猜的话,我会说你一次不会超过 5 个用户。 You'll have to combine the results into a single list yourself.您必须自己将结果合并到一个列表中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM