I'm trying to get the filtered stream to work in my code so I can search for hashtags in tweets. for example search tweets for the tag #btsno. Here's the snippet of the code in my program:
Many thanks in advance
EDIT:
I've also tried using:
It was a silly mistake. I forgot to start the thread, must be a morning coffee issue.
Thanks for Tweetinvi it works like a charm!
// Twitter API Credentials - Removed for posting
TwitterProfile profile = new TwitterProfile();
profile.AccessToken = "...";
profile.AccessTokenSecret = "...";
profile.ConsumerKey = "...";
profile.ConsumerSecret = "...";
// Set credentials
TwitterCredentials.SetCredentials(profile);
// Create stream
var filteredStream = Stream.CreateFilteredStream();
// Add tracks to the stream
filteredStream.AddTrack("btsno");
filteredStream.AddTrack("%23btsno");
filteredStream.AddTrack("#btsno");
// Add event to be raised when a tweet is received
//stream.MatchingTweetReceived += TweetReceived;
filteredStream.MatchingTweetReceived += (sender, args) => {
Console.WriteLine(args.Tweet.Text);
};
// Start the stream in a new thread
Thread t = new Thread(() =>
{
// Start the stream matching any of the conditions
filteredStream.StartStreamMatchingAllConditions();
});
t.Start();
I've tried searching for hashtags in tweets and that works fine but the stream doesn't appear to work. Am I missing anything in my code or making a silly mistake somewhere?Many thanks in advance
EDIT:
I've also tried using:
filteredStream.StartStreamMatchingAnyCondition();
EDIT:It was a silly mistake. I forgot to start the thread, must be a morning coffee issue.
t.Start();
I'll leave the code here encase anyone needs it, otherwise linvi you may delete this thread. Thanks for Tweetinvi it works like a charm!