【问题标题】:Counting trending tweets with geo code使用地理代码计算趋势推文
【发布时间】:2014-01-20 19:57:42
【问题描述】:

我正在尝试查找土耳其每个城市的热门推文。但“TwitterGeoLocationSearch”结果返回零。我正在使用 TweetSharp 2.0 和 Visual Studio 2010。

请检查我的代码块。这里:

      private void btnTweetSearch_Click(object sender, EventArgs e)
    {
    service = new TwitterService("xxxx", "xxxxx", "xxxxxxx", "xxxxxxxx");

     var   CityGeoCode = new TwitterGeoLocationSearch(37.0000000, 35.3213330, 10, TwitterGeoLocationSearch.RadiusType.Km);

    var tweetss = service.Search(new SearchOptions { Q = " Turkey ", Count = 1000, Geocode = CityGeoCode });

            var TweetwithGeo = tweetss.Statuses.Where(x => x.Location != null );

          foreach (var tweet in TweetwithGeo)
            {

                    lbTweetWindow.Items.Add(tweet.Text);

                }

        } 

}

任何帮助,将不胜感激。谢谢。

【问题讨论】:

    标签: twitter tweetsharp


    【解决方案1】:

    您的代码正在完美执行。 只需去 twitter 开发者那里获取你的 consumerKey、consumerSecret、AccessToken、AccessTokenSecret

        private void btnTweetSearch_Click(object sender, EventArgs e) 
        {
    
                /* Your Authentication Code */
                var service = new TwitterService(_consumerKey, _consumerSecret);
                service.AuthenticateWith(_accessToken, _accessTokenSecret);
    
                /* Your Tweet Extracting code */
                var   CityGeoCode = new TwitterGeoLocationSearch(37.0000000, 35.3213330, 10, TwitterGeoLocationSearch.RadiusType.Km);
    
                var tweetss = service.Search(new SearchOptions { Q = " Turkey ", Count = 1000, Geocode = CityGeoCode });
    
                var TweetwithGeo = tweetss.Statuses.Where(x => x.Location != null );
    
                foreach (var tweet in TweetwithGeo)
                {
    
                    lbTweetWindow.Items.Add(tweet.Text);
                }
    
         }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-23
      • 1970-01-01
      • 1970-01-01
      • 2018-07-18
      • 1970-01-01
      • 1970-01-01
      • 2020-01-16
      • 2021-07-25
      相关资源
      最近更新 更多