Getting Filtered Statuses

Return statuses matching given filters.

Type: StreamingType.Filter
Signature:
Parameters/Filters:
Name Purpose Type Required
Delimited Tweets are delimited in the stream string no
Follow Limit results to comma-separated set of users string no
Locations Get tweets in the comma-separate list of lat/lon string no
Track Comma-separated list of keywords to get tweets for string no
StallWarnings Whether stall warnings should be delivered bool no

Note: At least one filter (Follow, Locations, or Track) must be specified.

Return Type: JSON string. Note: azyobuzin has created UserStreamsParser for LinqToTwitter
v3.0 Example:
            Console.WriteLine("\nStreamed Content: \n");
            int count = 0;

            await
                (from strm in twitterCtx.Streaming
                 where strm.Type == StreamingType.Filter &&
                       strm.Track == "twitter"
                 select strm)
                .StartAsync(async strm =>
                {
                    Console.WriteLine(strm.Content + "\n");

                    if (count++ >= 5)
                        strm.CloseStream();
                });
v2.1 Example:
            twitterCtx.StreamingUserName = "";
            twitterCtx.StreamingPassword = "";

            if (twitterCtx.StreamingUserName == string.Empty ||
                twitterCtx.StreamingPassword == string.Empty)
            {
                Console.WriteLine("\n*** This won't work until you set the StreamingUserName and StreamingPassword on TwitterContext to valid values.\n");
                return;
            }

            Console.WriteLine("\nStreamed Content: \n");
            int count = 0;

            (from strm in twitterCtx.Streaming
                where strm.Type == StreamingType.Filter &&
                    strm.Track == "twitter"
                select strm)
            .StreamingCallback(strm =>
            {
                if (strm.Status != TwitterErrorStatus.Success)
                {
                    Console.WriteLine(strm.Error.ToString());
                    return;
                }

                Console.WriteLine(strm.Content + "\n");

                if (count++ >= 2)
                {
                    strm.CloseStream();
                }
            })
            .SingleOrDefault();

Twitter API: statuses/filter

Last edited Nov 29, 2013 at 4:58 AM by JoeMayo, version 6