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

New Post: Get Tweets and geo locations of tweets by keywords.

$
0
0
I am trying to get tweets and geo location of different tweets by keyword using Streaming Api.I am beginner at this so i tried but after start debugging it just shows a blank console.Can you help me with this or point me to the right direction.
Thanks.
 private const string USER_SCREEN_NAME_TO_TEST = "ladygaga";
        static void Main()
        {
            TwitterCredentials.SetCredentials("xxxx", "xxxx", "xxxx", "xxxx");


            Stream_FilteredStreamExample();
          
        }



        private static void Stream_FilteredStreamExample()
        {
            var stream = Stream.CreateFilteredStream();
            var location = Geo.GenerateLocation(-124.75, 36.8, -126.89, 32.75);

            stream.AddLocation(location);
            stream.AddTrack("Ebola");
            stream.AddTrack("Obama");

            stream.MatchingTweetAndLocationReceived += (sender, args) =>
            {
                var tweet = args.Tweet;
                Console.WriteLine("{0} was detected between the following tracked locations:", tweet.Id);

                IEnumerable<ILocation> matchingLocations = args.MatchedLocations;
                foreach (var matchingLocation in matchingLocations)
                {
                    Console.Write("({0}, {1}) ;", matchingLocation.Coordinate1.Latitude, matchingLocation.Coordinate1.Longitude);
                    Console.WriteLine("({0}, {1})", matchingLocation.Coordinate2.Latitude, matchingLocation.Coordinate2.Longitude);
                }
            };

            stream.StartStreamMatchingAllConditions();
        }

           
        }
    }

Viewing all articles
Browse latest Browse all 4126

Trending Articles