question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AniaBerthelotcommented, Aug 15, 2020

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

1reaction
gabenotgavecommented, Aug 14, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Streams - Filter all not throwing exception
There is nothing like " filterThrowingException " in the current Stream-API. You can do only to make a decision to keep or filter...
Read more >
Filtered stream disconnects every 5 minutes on nodejs
Hi, my filtered stream on an academic account suddenly started to disconnect every five minutes without throwing an error.
Read more >
Filtered Stream - Filters — Tweetinvi 5.0.4 documentation
The track filters let you track the tweets containing specific keywords. .AddTrack allow you to add a track filter to your stream.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found