tweetinvi: AddFollow() does nothing in 4.0 and throws a TwitterException in 5.0 (Filtered Streams)

Hi!

“AddTrack” works for a filtered stream, but “AddFollow” does not. All I’m trying to do is get an event when “Reuters” tweets something. Here is the repro.

  1. Use real credentials in Auth.SetUserCredentials()
  2. Start the program. Notice no tweets received (Reuters tweets every few minutes). Stop the program.
  3. If you uncomment the AddTrack, you’ll notice you start getting tweets for “software”. However, you still never get tweets from Reuters.
using System;
using System.Threading;
using Tweetinvi;
using Tweetinvi.Models;

namespace TweetinviTest
{
    class Program
    {
        static void Main(string[] args)
        {
            ExceptionHandler.SwallowWebExceptions = false;
            TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended;
            Auth.SetUserCredentials("removed", "removed", "removed", "removed");

            var stream = Stream.CreateFilteredStream();
            //stream.AddTrack("software");  // This works!
            stream.AddFollow(new UserIdentifier("Reuters")); // This does NOT work
            stream.MatchingTweetReceived += (sender, args) => Console.WriteLine(args.Tweet.FullText);
            stream.StartStreamMatchingAnyCondition();

            Thread.Sleep(Int32.MaxValue);
        }
    }
}

In the latest 5.0.0 version, the below code throws the TwitterException with Message: “No filter parameters found. Expect at least one parameter: follow track locations”. Is it possible to only receive tweets from a single user like this?

using System;
using System.Threading.Tasks;
using Tweetinvi;
using Tweetinvi.Models;

namespace TweetinviTest
{
    class Program
    {
        public static async Task Main(string[] args)
        {
            var credentials = new TwitterCredentials("removed", "removed", "removed", "removed");
            var client = new TwitterClient(credentials);

            var stream = client.Streams.CreateFilteredStream();
            stream.AddFollow(new UserIdentifier("Reuters"));
            stream.MatchingTweetReceived += (sender, args) => Console.WriteLine("Reuters tweet: " + args.Tweet.FullText);
            await stream.StartMatchingAnyConditionAsync(); // throws TwitterException with Message "No filter parameters found. Expect at least one parameter: follow track locations"
        }
    }
}

Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I do agree with you @gabenotgave streaming is an essential feature, and all my dev work is dependent on it.

Really hope this issue can be solved soon, @linvi. Project won’t work without it lol.

@NorthwestAlpineSystems thanks for sharing, I will be looking into this.