0

I just started making a application that uses information from twitter. I want to get the posts that are available on the Twitter landing page when no user is logged in. This page shows public posts that might be relevant to your geo location. Is it possible to get these posts using LinqToTwitter without logging in a user?

Maiko Kingma
  • 929
  • 3
  • 14
  • 29
  • You are asking for an [application-only](https://dev.twitter.com/oauth/application-only) authentication, that is not the typical approach to Twitter API. Anyway it looks like a **duplicate** question. The answer is here: http://stackoverflow.com/questions/16387037/twitter-api-application-only-authentication-with-linq2twitter –  Aug 21 '16 at 14:23
  • Thanks in advance for your answer. I wont be looking at this till next thursday. – Maiko Kingma Aug 22 '16 at 08:00

1 Answers1

2

Authentication without user context

As per my comment, this is called application-only authentication, and the documentation of LinqToTwitter about it actually mentions this answer of Joe Mayo that I've already suggested you to follow.

Geolocation

Finally, look at this doc for the GeoCode: something like what was done in this post

var auth = new ApplicationOnlyAuthorizer
{
    Credentials = new InMemoryCredentials
    {
        ConsumerKey = [ConsumerKey],
        ConsumerSecret = [ConsumerSecret]
    }
};

auth.Authorize();

var _twitterContext = new TwitterContext(auth);

var srch =
    (from search in _twitterContext.Search
     where search.Type == SearchType.Search &&
           search.Query == "twitter" &&
           search.Count == 7 &&
           search.GeoCode == "51.507351,-0.127758,1km"
     select search)
    .SingleOrDefault();

Console.WriteLine("\nQuery: {0}\n", srch.SearchMetaData.Query);
srch.Statuses.ForEach(entry =>
    Console.WriteLine(
        "ID: {0, -15}, Source: {1}\nContent: {2}\n",
        entry.StatusID, entry.Source, entry.Text));

Console.ReadLine();
Community
  • 1
  • 1
  • This is a very good way to emulate the twitter homepage. I have taken the center geolocation of my country with the maximum radius of my country. I also added `search.ResultType == Twitter.ResultType.Popular`. – Maiko Kingma Nov 02 '16 at 10:46