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

New Post: Hi! I created a stream and besides the text of a tweet, I want to get the coordinates.

$
0
0
Hello!


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tweetinvi;
using TwitterStream;


namespace TwitterStream
{
class Program
{

    static void Main(string[] args)
    {
        TwitterCredentials.SetCredentials(...);

        TwitterStream();
        Console.ReadLine();

    }

    private static void TwitterStream()
    {

        var stream = Stream.CreateSampleStream();
        stream.TweetReceived += (sender, args) =>
        {
            Console.WriteLine(args.Tweet.Coordinates.Latitude);
        };

        stream.StartStream();
    }


}
}

If I try to get only the text, it works fine, but if I want the location, it throws me an exception: "An exception of type 'System.NullReferenceException' occurred in TwitterStream.exe but was not handled in user code".

Any help would be appreciated.

Thanks!

Viewing all articles
Browse latest Browse all 4126

Trending Articles