Created
February 1, 2013 09:54
-
-
Save webmonger/4690423 to your computer and use it in GitHub Desktop.
.net Razor helper to be used with LinqToTwitter http://linqtotwitter.codeplex.com/ put the 4 oAuth keys for Single User Auth in your web.config and you've done you recieve a List<Status>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IList<Status> GetTwitterFeed(string screenName) | |
{ | |
var auth = new SingleUserAuthorizer() | |
{ | |
Credentials = new InMemoryCredentials | |
{ | |
ConsumerKey = | |
ConfigurationManager.AppSettings["twitterConsumerKey"], | |
ConsumerSecret = | |
ConfigurationManager.AppSettings["twitterConsumerSecret"], | |
OAuthToken = ConfigurationManager.AppSettings["twitterOAuthToken"], | |
AccessToken = | |
ConfigurationManager.AppSettings["twitterAccessToken"] | |
} | |
}; | |
List<Status> tweets; | |
using ( | |
var twitterCtx = new TwitterContext(auth, "https://api.twitter.com/1/", "https://search.twitter.com/")) | |
{ | |
//Log | |
twitterCtx.Log = Console.Out; | |
var publicTweets = from tweet in twitterCtx.Status | |
where tweet.Type == StatusType.User | |
&& tweet.ScreenName == screenName | |
select tweet; | |
tweets = publicTweets.ToList(); | |
} | |
return tweets; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Status> tweets = GetTwitterFeed("billywizz") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey I think in your call example in gistfile2.text it should be IList not List?