public static TwitterCollection LoadTwitterCollection(IfyContext context) { List <TwitterFeed> result = new List <TwitterFeed>(); TwitterApplication app = new TwitterApplication(context.GetConfigValue("Twitter-consumerKey"), context.GetConfigValue("Twitter-consumerSecret"), context.GetConfigValue("Twitter-token"), context.GetConfigValue("Twitter-tokenSecret")); var collection = new TwitterCollection(app, context.BaseUrl); collection.Identifier = "tweet"; collection.Accounts = new List <TwitterAccount>(); EntityList <TwitterNews> twitters = new EntityList <TwitterNews>(context); twitters.Load(); foreach (TwitterNews news in twitters) { var tags = news.Tags != null ? new List <string>(news.Tags.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)) : null; collection.Accounts.Add(new TwitterAccount { Title = news.Title, Author = news.Author, Tags = tags }); } return(collection); }
/// <summary> /// Loads the twitter feeds. /// </summary> /// <returns>The twitter feeds.</returns> /// <param name="context">Context.</param> public static List <TwitterFeed> LoadTwitterFeeds(IfyContext context) { List <TwitterFeed> result = new List <TwitterFeed>(); TwitterApplication app = new TwitterApplication(context.GetConfigValue("Twitter-consumerKey"), context.GetConfigValue("Twitter-consumerSecret"), context.GetConfigValue("Twitter-token"), context.GetConfigValue("Twitter-tokenSecret")); EntityList <TwitterNews> twitters = new EntityList <TwitterNews>(context); twitters.Load(); foreach (TwitterNews news in twitters) { TwitterFeed feed = new TwitterFeed(app, context.BaseUrl); feed.Identifier = news.Identifier; feed.Title = news.Title; feed.Tags = (news.Tags != null ? new List <string>(news.Tags.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)) : null); feed.Time = news.Time; feed.Url = news.Url; feed.Author = news.Author; feed.AuthorImageUrl = news.AuthorImage; feed.Content = news.Content; result.Add(feed); } return(result); }
public async Task GetRequestToken(TwitterApplication application) { this.application = application; var data = await TwitterClient.Current.GetRequestToken(this.application.ConsumerKey, this.application.ConsumerSecret).ToTask(); this.requestToken = data.Token; Process.Start(data.AuthorizeUrl.ToString()); }
static void Main(string[] args) { string aranan; bool hastag = false; Console.Write("İlgili Tweetin Çekileceği Kelime (Hashtag Arama İçin Kelimenin Başına # Koyunuz) :"); string kelime = Console.ReadLine(); char durum = kelime[0]; if (durum.Equals("#")) { hastag = true; aranan = donustur(kelime); } aranan = kelime; Console.Write("Kaç Adet Tweet Çekilsin? :"); int tweet_sayisi = Convert.ToInt32(Console.ReadLine()); uygulama = new TwitterApplication(); uygulama.InitTwitter(aranan, tweet_sayisi, hastag, null, null); ArrayList tweetler = uygulama.GetTweetsArray(); ArrayList stringler = uygulama.TweetsArrayToString(tweetler); int i = 1; foreach (string tweet in stringler) { Console.WriteLine("------------------------------"); Console.WriteLine(i + ". Tweet"); Console.WriteLine(tweet); i++; } MySqlConnection baglan = new MySqlConnection("Server=localhost;Database=proje;Uid=root;Pwd=123456"); int j = 1; foreach (Person p in tweetler) { try { baglan.Open(); string kadi = p.UserName, kismi = p.FullName, tweet = p.TweetContent; string komut = "insert into twitter(kullanici_adi,kullanici_ismi,tweet) values('" + kadi + "','" + kismi + "','" + tweet + "')"; MySqlCommand kmt = new MySqlCommand(komut, baglan); kmt.ExecuteNonQuery(); Console.WriteLine(j + ". kayıt başarıyla kayıt edildi"); j++; baglan.Close(); } catch (Exception err) { Console.WriteLine("bir hata oluştu :" + err); baglan.Close(); } } Console.Read(); }
public ActionResult AddApplication(TwitterApplication app) { string error = ""; clBusiness.AddTwitterApplication(app, ref error); if (string.IsNullOrEmpty(error)) { return(RedirectToAction("Index")); } return(View(app)); }
static void Main(string[] args) { var ser = new TwitterService(); var app = new TwitterApplication(); //app.Test(); //app.TweetFavoritestRanking(7,5); var line = new LINEService(); var str = Task.Run(() => line.GetTokenInformation()); Console.WriteLine(str); line.PostMessage(); line.PostMessage("Hello Line Message World !"); }