2010-12-14 273 views

回答

1

所以你想获得用户所做的所有鸣叫提及用户(又名被发送到用户)所有的鸣叫?

对于先看到的,

http://dev.twitter.com/doc/get/statuses/public_timeline

对于第二个看到,

http://dev.twitter.com/doc/get/statuses/mentions

您需要使用OAuth认证访问后者API调用。

+0

还有一件事我们可以删除tweet吗? – Sandhurst 2010-12-14 10:49:35

+0

是的。 http://dev.twitter.com/doc/post/statuses/destroy/:id – 2010-12-14 10:55:04

0

我最近写了一些东西。希望这可以帮助。 http://blog.rohit-lakhanpal.info/2013/06/console-app-that-displays-twitter-feed.html

using System; 
using System.Linq; 
using LinqToTwitter; 
using System.Threading; 

namespace Linq2Twitter 
{ 
    class Program 
    { 
     /// <summary> 
     /// Controls the flow of the program. 
     /// </summary> 
     /// <param name="args">The args.</param> 
     static void Main(string[] args) 
     { 
      // This is a super simple example that 
      // retrieves the latest tweets of a given 
      // twitter user. 

      // SECTION A: Initialise local variables 
      Console.WriteLine("SECTION A: Initialise local variables"); 

      // Access token goes here .. (Please generate your own) 
      const string accessToken = "Access token goes here .. (Please generate your own)"; 
      // Access token secret goes here .. (Please generate your own) 
      const string accessTokenSecret = "Access token secret goes here .. (Please generate your own)"; 

      // Api key goes here .. (Please generate your own) 
      const string consumerKey = "Api key goes here .. (Please generate your own)"; 
      // Api secret goes here .. (Please generate your own) 
      const string consumerSecret = "Api secret goes here .. (Please generate your own)"; 

      // The twitter account name goes here 
      const string twitterAccountToDisplay = "roeburg"; 


      // SECTION B: Setup Single User Authorisation 
      Console.WriteLine("SECTION B: Setup Single User Authorisation"); 
      var authorizer = new SingleUserAuthorizer 
      { 
       CredentialStore = new InMemoryCredentialStore 
       { 
        ConsumerKey = consumerKey, 
        ConsumerSecret = consumerSecret, 
        OAuthToken = accessToken, 
        OAuthTokenSecret = accessTokenSecret 
       } 
      }; 

      // SECTION C: Generate the Twitter Context 
      Console.WriteLine("SECTION C: Generate the Twitter Context"); 
      var twitterContext = new TwitterContext(authorizer); 

      // SECTION D: Get Tweets for user 
      Console.WriteLine("SECTION D: Get Tweets for user"); 
      var statusTweets = from tweet in twitterContext.Status 
           where tweet.Type == StatusType.User && 
             tweet.ScreenName == twitterAccountToDisplay && 
             tweet.IncludeContributorDetails == true && 
             tweet.Count == 10 && 
             tweet.IncludeEntities == true 
           select tweet; 

      // SECTION E: Print Tweets 
      Console.WriteLine("SECTION E: Print Tweets"); 
      PrintTweets(statusTweets); 
      Console.ReadLine(); 
     } 

     /// <summary> 
     /// Prints the tweets. 
     /// </summary> 
     /// <param name="statusTweets">The status tweets.</param> 
     /// <exception cref="System.NotImplementedException"></exception> 
     private static void PrintTweets(IQueryable<Status> statusTweets) 
     { 
      foreach (var statusTweet in statusTweets) 
      { 
       Console.WriteLine(string.Format("\n\nTweet From [{0}] at [{1}]: \n-{2}", 
        statusTweet.ScreenName, 
        statusTweet.CreatedAt, 
        statusTweet.Text)); 

       Thread.Sleep(1000); 
      } 
     } 
    } 
} 
相关问题