Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Searching tweets

$
0
0
Hi linvi,

These are the two ways to tweets using tweetinvi i am using asp.net web application version .net framework 4.0

First Method using filteredstream

/// <summary>
/// to get the tweets based on the streaming api
/// </summary>
public void getstreamapidata()
{
var requestAccount = Tweetinvi.User.GetFollowers("viswadattu");
var responseAccount = Tweetinvi.User.GetFollowers("dattu_work");
var result = (from p in requestAccount join q in responseAccount on p.Id equals q.Id select p).ToList();
var filteredstream = Stream.CreateFilteredStream();
filteredstream.AddTrack("@viswadattu");
filteredstream.MatchingTweetReceived += (sender, e) => {
foreach (var followers in result)
{
if (e.Tweet.Creator.Id == followers.Id)
{
// save the tweets in the database and process them and give response to the followers
}
}
};//here we can save in the database.
filteredstream.StartStreamMatchingAllConditions();
filteredstream.StopStream();
}

second method using normal search api

public void getTwitterUserData()
{
var searchParameter = Search.CreateTweetSearchParameter("@viswadattu");
var tweets = Search.SearchTweets(searchParameter);

foreach (var item in tweets)
{
if(item.Hashtags.Any())
{
for (int i = 0; i < item.Hashtags.Count; i++)
{
string hashTagText = item.Hashtags[i].Text; // to append the hashtag
}
}
}
}

i request you to please guide me the most effective way for getting tweets without loss of tweets for my scenario from particular twitter handle ie@viswadattu

Thanks in advance

Viswadattu



Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>