0
TwitterService service = new TwitterService();
service.AuthenticateWith("XXXXXX", "XXXXXXX");
// Geting Tweets On Specific Topic
var twts = service.Search("#ghaza", 100);
List<TwitterSearchStatus> resultList = new List<TwitterSearchStatus>(twts.Statuses);
foreach (var twt in resultList)
{
    Console.WriteLine(twt.Text);
}

I use this code to get tweets on ghaza there are two things which i want to know

  1. What should i do to get result in json form
  2. This is giving me some strange output in start like:
    join karain
     #IRAN
     #IRAQ
     #PAK
     #SHAM
     #GHAZA

and after iterating this some time, then it show me the tweets, which i want to get in json format

I use this:

Console.WriteLine("{0} says '{1}'", twt.User.ScreenName, twt.Text);

but its not working in it.

1 Answers1

1

This is working for me

TwitterResponse<TwitterSearchResultCollection> tr = TwitterSearch.Search("#christmas");

TwitterSearchResultCollection results = tr.ResponseObject;
List<TwitterSearchResult> resultList = results.ToList();

foreach ( TwitterSearchResult resultRow in resultList ) {
    messages.AppendText( "\n" + resultRow.Text );
}

The TwitterSearchResult object has the following properties (found in the documentation):

CreatedDate 

Gets or sets the created date.

FromUserId  

Gets or sets from user id.

FromUserScreenName  

Gets or sets the name of from user screen.

Geo 

Gets or sets the geo location associated with the result.

Id  

Gets or sets the status id.

Language    

Gets or sets the language.

Location    

Gets or sets the location.

ProfileImageLocation    

Gets or sets the profile image URL.

Source  

Gets or sets the source.

Text    

Gets or sets the status text.

ToUserId    

Gets or sets to user id.

ToUserScreenName    

Gets or sets the name of to user screen.

Michel Feldheim
  • 17,625
  • 5
  • 60
  • 77