public static void Tweeti() { TwitterCredentials.SetCredentials("3193275575-5loWqKJY7xSM56R1x0VBGCskbmepFALW0w0Clys", "nMzmKhnBeFAmGzwZK8PWo23JM9JKlLorzQpJXEkU2NUHq", "mOY3kXffR1v4jXrEwbatnVGlF", "vx1VkVBxoCjn5Rb5mCzvt6j5HmRIlsSSnKHHeSRbV1B3Gyaiax"); var user = User.GetLoggedUser(); Tweet.PublishTweet("Alonso es toda"); }
public void LoginAsDev() { if (!loggedIn) { if (!IsConnectedToInternet()) { FOutputStatus[0] = "Internet is f****d bro. Can't login as dev..."; FLogger.Log(LogType.Debug, "Internet is f****d bro. Can't login as dev..."); FOutputStatusBool[0] = false; loggedIn = false; ClearOutputPins(); } else { try { TwitterCredentials.SetCredentials(FDevCredentials[0], FDevCredentials[1], FCredentials[0], FCredentials[1]); //TwitterCredentials.SetCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret"); GetRateLimits("Login failed! Bad credentials?"); } catch { FOutputStatus[0] = "Bad application or dev credentials, monsieur tete de bite."; FLogger.Log(LogType.Debug, "Bad application or dev credentials, monsieur tete de bite."); } } } else { FOutputStatus[0] = "You're already logged in, you douche, logout first."; FLogger.Log(LogType.Debug, "You'RE already logged in, you douche, logout first."); } }
public void CreateStream() { TwitterCredentials.SetCredentials( RoleEnvironment.GetConfigurationSettingValue("UserAccessToken"), RoleEnvironment.GetConfigurationSettingValue("UserAccessSecret"), RoleEnvironment.GetConfigurationSettingValue("ConsumerKey"), RoleEnvironment.GetConfigurationSettingValue("ConsumerSecret")); //rateLimit = new ProtectedTimer(TimeSpan.FromSeconds(60), new Action(OnCheckRateRequestLimit)); //rateLimit.Start(); string words = RoleEnvironment.GetConfigurationSettingValue("TwitterSearchTerms"); string[] items = words.Split(';'); foreach (var item in items) { if (!string.IsNullOrEmpty(item)) { stream.AddTrack(item); Trace.Write(string.Concat("Track item -> ", item), typeof(TwitterStreamingEngine).FullName); } } stream.MatchingTweetReceived += OnMatchingTweetReceived; stream.DisconnectMessageReceived += OnStreamDisconnectMessageReveived; stream.WarningFallingBehindDetected += OnWarningFallingBehindDetected; stream.LimitReached += OnLimitReached; stream.StreamStarted += OnStreamStarted; stream.StreamStopped += OnStreamStopped; stream.StartStreamMatchingAllConditions(); }
public static List <TweetDisplay> GetTweets(string searchCriteria) { // initialise a Credentials object with the keys supplied by the twitter api registration var credentials = CredentialsCreator.GenerateApplicationCredentials(consumerKey, consumerSecret); // tell twitter our credentials TwitterCredentials.SetCredentials(credentials.AuthorizationKey, credentials.AuthorizationSecret, credentials.ConsumerKey, credentials.ConsumerSecret); // Search the tweets containing the search criteria and create a list to display in the view, only use top 4 var items = Search.SearchTweets(searchCriteria).OrderByDescending(a => a.CreatedAt).ToList().Take(4); // create an empty list var results = new List <TweetDisplay>(); // Make a list of tweet items for using in the view foreach (var item in items) { var td = new TweetDisplay { CreatedAt = item.CreatedAt, Author = item.Creator.Name, Tweet = item.Text, ImageUrl = item.Creator.ProfileImageUrl }; results.Add(td); } return(results); }
public TwitterSampleSpout(Context context) { //Set the context this.context = context; //TODO: VERY IMPORTANT - Declare the schema for the outgoing tuples for the upstream bolt tasks //As this is a spout, you can set inputSchema to null in ComponentStreamSchema Dictionary <string, List <Type> > outputSchema = new Dictionary <string, List <Type> >(); outputSchema.Add(Constants.DEFAULT_STREAM_ID, new List <Type>() { typeof(string) }); this.context.DeclareComponentSchema(new ComponentStreamSchema(null, outputSchema)); //TODO: Specify your twitter credentials in App.Config TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["TwitterAccessToken"], ConfigurationManager.AppSettings["TwitterAccessTokenSecret"], ConfigurationManager.AppSettings["TwitterConsumerKey"], ConfigurationManager.AppSettings["TwitterConsumerSecret"]); //Setup a Twitter Stream as per your requirements CreateSampleStream(); //CreateFilteredStream(); }
public Twitter() { TwitterCredentials.SetCredentials(Properties.Settings.Default.access_token, Properties.Settings.Default.access_token_secret, Properties.Resources.api_key, Properties.Resources.api_key_secret); }
public List <ITweet> GetTweets(string searchKey) { TwitterCredentials.SetCredentials(accesstoken, Access_TokenSceret, ConsumerKey, Consumer_Secret); List <ITweet> result = SearchTweetsBystream(TwitterCredentials.Credentials, searchKey); return(result); }
/// <summary> /// Setting up twitter app credentials /// </summary> public static void SetCredentials() { //Initializing a Token with Twitter Credentials contained in the App.config _accessToken = ConfigurationManager.AppSettings["token_AccessToken"]; _accessTokenSecret = ConfigurationManager.AppSettings["token_AccessTokenSecret"]; _consumerKey = ConfigurationManager.AppSettings["token_ConsumerKey"]; _consumerSecret = ConfigurationManager.AppSettings["token_ConsumerSecret"]; TwitterCredentials.SetCredentials(_accessToken, _accessTokenSecret, _consumerKey, _consumerSecret); }
public TwitterStartup() { TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["tw.accessToken"], ConfigurationManager.AppSettings["tw.accessSecret"], ConfigurationManager.AppSettings["tw.consumerKey"], ConfigurationManager.AppSettings["tw.consumerSecret"] ); }
public void SetupTwitterApi(string twitterAccessToken, string twitterAccessTokenSecret, string twitterConsumerKey, string twitterConsumerSecret) { TwitterCredentials.SetCredentials(twitterAccessToken, twitterAccessTokenSecret, twitterConsumerKey, twitterConsumerSecret); var user = User.GetLoggedUser(); UserLogged = AutoMapper.Mapper.Map <Models.TwitterUser> (user); }
static void Main(string[] args) { TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["token_AccessToken"], ConfigurationManager.AppSettings["token_AccessTokenSecret"], ConfigurationManager.AppSettings["token_ConsumerKey"], ConfigurationManager.AppSettings["token_ConsumerSecret"]); //Search_FilteredSearch(); Stream_FilteredStreamExample(); //Stream_SampleStreamExample(); }
private void ListenerThreadFunction() { TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["token_AccessToken"], ConfigurationManager.AppSettings["token_AccessTokenSecret"], ConfigurationManager.AppSettings["token_ConsumerKey"], ConfigurationManager.AppSettings["token_ConsumerSecret"]); while (threadRunning) { try { //var hbase = new HBaseWriter(); stream = Stream.CreateFilteredStream(); var location = Geo.GenerateLocation(-180, -90, 180, 90); stream.AddLocation(location); var tweetCount = 0; var timer = Stopwatch.StartNew(); stream.MatchingTweetReceived += (sender, args) => { tweetCount++; var tweet = args.Tweet; // Store indexItem in the buffer lock (queue) { queue.Enqueue(tweet); } if (timer.ElapsedMilliseconds > 1000) { if (tweet.Coordinates != null) { Context.Logger.Info("{0}: {1} {2}", tweet.Id, tweet.Language.ToString(), tweet.Text); Context.Logger.Info("\tLocation: {0}, {1}", tweet.Coordinates.Longitude, tweet.Coordinates.Latitude); } timer.Restart(); Context.Logger.Info("===== Tweets/sec: {0} =====", tweetCount); tweetCount = 0; } }; stream.StartStreamMatchingAllConditions(); } catch (Exception ex) { Context.Logger.Fatal("Exception: {0}", ex.Message); } } }
static void Main(string[] args) { string LocalPath = new Uri(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\").LocalPath; var access_token = "7611822-mxRQ6rojK9RyE8nJO0dJcK4PJVrEfvn8g6g1QIVdcA"; var access_token_secret = "1Km6Zd0ZTQgu7mrL6nHTDt5idsdkK03MMh3pOoli9IfNr"; var consumer_key = "Yy1zYgxWFRKdUWMuzPkqWyNjm"; var consumer_secret = "59Q369BgteBFygj7nw00YZPRNBe15L9aXEQdDHO5LELB4OEsaQ"; TwitterCredentials.SetCredentials(access_token, access_token_secret, consumer_key, consumer_secret); var tags = new List <string>(); var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { var inputfile = options.InputFile; if (File.Exists(inputfile)) { Console.WriteLine("Opening \"" + inputfile + "\""); string line; // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader(inputfile); while ((line = file.ReadLine()) != null) { tags.Add(line); } file.Close(); Console.WriteLine("Found " + tags.Count() + " tag(s)"); Console.WriteLine("Press any key to Start!"); CashTags cashTags = new CashTags(tags); Console.ReadLine(); cashTags.Start(); Console.ReadLine(); cashTags.Stop(); } else { Console.WriteLine("No existing input file!" + inputfile); } } }
public static void MineTwitter(string term) { TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["AccessToken"], ConfigurationManager.AppSettings["AccessSecret"], ConfigurationManager.AppSettings["ConsumerKey"], ConfigurationManager.AppSettings["ConsumerSecret"]); IFilteredStream stream = Tweetinvi.Stream.CreateFilteredStream(); stream.MatchingTweetReceived += Stream_TweetReceived; stream.AddTrack(term); stream.StartStreamMatchingAllConditions(); }
static void Main(string[] args) { string url = "http://localhost:8181"; using (WebApp.Start(url)) { //Console.WriteLine("Server running on {0}", url); TwitterCredentials.SetCredentials(_accessKey, _accessToken, _consumerKey, _consumerSecret); //Task.Factory.StartNew(() => Stream_FilteredStreamExample()); Stream_FilteredStreamExample(); //Stream_SampleStreamExample(); } }
public TwitterHandle(IActorRef theActor) { twitterActorRef = theActor; NameValueCollection configSettings = ConfigurationManager.AppSettings; string userAccessSecret = configSettings["TWITTER_ACCESSSECRET"]; string userAccessToken = configSettings["TWITTER_ACCESSTOKEN"]; string consumerKey = configSettings["TWITTER_CONSUMERKEY"]; string consumerSecret = configSettings["TWITTER_CONSUMERSECRET"]; TwitterCredentials.SetCredentials(userAccessToken, userAccessSecret, consumerKey, consumerSecret); ReCreateFilteredStream(); }
public TweetRepository(string apiKey, string apiKeySecret, string accessToken, string accessTokenSecret) { const string KEY_API = @"ApiKey"; const string KEY_APIPRIVATE = @"ApiSecret"; const string KEY_TOKEN = @"AccessToken"; const string KEY_TOKENPRIVATE = @"AccessTokenSecret"; TwitterCredentials.SetCredentials( GetConfigValue(accessToken, KEY_TOKEN), GetConfigValue(accessTokenSecret, KEY_TOKENPRIVATE), GetConfigValue(apiKey, KEY_API), GetConfigValue(apiKeySecret, KEY_APIPRIVATE)); _userStream = Stream.CreateUserStream(); CreateEventBindings(); }
static void Main(string[] args) { hbaseWriter = new HBaseWriter(); string consumerKey = ConfigurationManager.AppSettings["ConsumerKey"]; string consumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"]; string accessToken = ConfigurationManager.AppSettings["AccessToken"]; string accessSecret = ConfigurationManager.AppSettings["AccessSecret"]; TwitterCredentials.SetCredentials(accessToken, accessSecret, consumerKey, consumerSecret); Task.Run(() => { StreamTwitter(); }); while (true) { ; } }
public void Evaluate(int SpreadMax) { //FLastSearchStatus[0]=lastSearchStatus; if (FLogin[0]) { /*try * {*/ if (!CheckForInternetConnection()) { FOutputStatus[0] = "Internet is f****d bro."; } else { //TwitterCredentials.SetCredentials(accToken, accSecret, consKey, consSecret); TwitterCredentials.SetCredentials(FCredentials[0], FCredentials[1], FCredentials[2], FCredentials[3]); var rateLimits = RateLimit.GetCurrentCredentialsRateLimits(); if (rateLimits != null) { FOutputStatus[0] = "F**k YEAH!/n Search Limit: " + rateLimits.SearchTweetsLimit.Limit.ToString() + " Search Remaining: " + rateLimits.SearchTweetsLimit.Remaining.ToString() + "/n FavoritesListLimit: " + rateLimits.FavoritesListLimit.Limit.ToString() + " Search Remaining: " + rateLimits.FavoritesListLimit.Remaining.ToString(); limitSearchRemaining = rateLimits.SearchTweetsLimit.Limit; limitResetTime = rateLimits.SearchTweetsLimit.ResetDateTime.ToString(); loggedIn = true; } else { FOutputStatus[0] = "Nope! Bad credentials."; loggedIn = false; } } // } /*catch (System.ArgumentNullException e) * { * lastSearchStatus = "Internet connection is f****d bro"; * throw new System.ArgumentNullException("Internet connection is f****d bro", e); * }*/ } }
private static IEnumerable <FSConversation> PopulateConversationsFromFile(string fileLocation) { List <FSConversation> conversations = new List <FSConversation>(); var data = File.ReadAllLines(fileLocation); TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["AccessToken"], ConfigurationManager.AppSettings["AccessSecret"], ConfigurationManager.AppSettings["ConsumerKey"], ConfigurationManager.AppSettings["ConsumerSecret"]); #region getdata foreach (string s in data) { var tweetTriplet = s.Split("\t".ToCharArray()); List <FSTweet> tweets = new List <FSTweet>(); foreach (string tweetId in tweetTriplet) { long id = long.Parse(tweetId); var t = Tweetinvi.Tweet.GetTweet(id); if (t != null) { var ptTweet = InviTweetToPTTweet(t); tweets.Add(ptTweet); } } if (tweets.Count > 0) { FSConversation c = new FSConversation(); Guid g = Guid.NewGuid(); c.Id = g.ToString(); c.Tweets = tweets; conversations.Add(c); PTHBaseWriter writer = new PTHBaseWriter(); writer.WriteConversation(c); } } #endregion getdata return(conversations); }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { hahahah.Visible = true; hehehee.Visible = true; } else { hahahah.Visible = false; hehehee.Visible = false; } TwitterCredentials.SetCredentials("329640683-JLYS3pwDm2HJspB9GT49DmFzaeyKqSPXe89I4YDY", "faOYo86yG8k6OWZzin6GONyELGmMTI5jhqa7riQB3RxfW", "YlPxqfbrwkQIaw0bLYJDLJW7E", "ifIh1cWabwSr5Jg7aqsqR2NANUBX25vWofcnBa1gSiRpTq3yZh"); Search_SearchTweet(); getPlaces(); // put codes here if (!IsPostBack) { LoadEvents(); } }
static void Main(string[] args) { TwitterCredentials.SetCredentials("16993590-Cvztsa1QmfKnMWzoFb3rI5gnSi9Mfb84lWFbuo3U7", "flmwsxw0mKqF8wPbwuEIG19JmCiUu6TtuWyP6QH4FAptu", "5TOLpTO4Qljofz1kziiLSNBLI", "fb2O8oqLzsG3KZ6FnX98FtMWXjYuLwyZKe2lpn4eJdwW2Vi000"); var southwest = new Coordinates(-125.711777, 30.618056); var northeast = new Coordinates(-64.495959, 49.281421); while (true) { var filteredStream = tweetStream.CreateFilteredStream(); filteredStream.AddLocation(southwest, northeast); filteredStream.MatchingTweetReceived += printTweet; filteredStream.StartStreamMatchingAllConditions(); } //sampleStream.TweetReceived += printTweet;//(sender, arguments) => { Console.WriteLine(arguments.Tweet.Text); }; //sampleStream.StartStream();//"https://stream.twitter.com/1.1/statuses/filter.json?language=en&locations=30.618056,-125.711777,49.281421,-64.495959"); }
/// <summary> /// Default constructor. /// </summary> public MainWindow() { InitializeComponent(); worldDatabase = new WorldDatabase(); createWorldView.drawingSpace1.Visibility = Visibility.Hidden; createWorldView.drawingSpace2.Visibility = Visibility.Hidden; createWorldView.drawingSpace3.Visibility = Visibility.Hidden; createWorldView.drawingSpace4.Visibility = Visibility.Hidden; createWorldView.saveCheck1Border.Visibility = Visibility.Hidden; createWorldView.saveCheck2Border.Visibility = Visibility.Hidden; createWorldView.saveCheck3Border.Visibility = Visibility.Hidden; createWorldView.saveCheck4Border.Visibility = Visibility.Hidden; CompositionTarget.Rendering += update; createWorldView.Hide(); TwitterCredentials.SetCredentials("3307331332-xhPgwZ663wad6U2vlpAp51ZYY9AlEHwAGTuNZJz", "E7Bgs2X5nHSExxBqG5VgRG8jHdU58kYc0BGnefhMCDvqP", "wh8BRnf9zZERLAWLKDcKlTeWf", "Ue4GqWWM0jaMHg3S02AkuZ4Jrhaqcx8wsx55j4OTczPQdGdsKj"); // Publish a tweet // Publish with media //var imageURL = tweet.Entities.Medias.First().MediaURL; }
public TwitterSpout(Context context) { this.context = context; Dictionary <string, List <Type> > outputSchema = new Dictionary <string, List <Type> >(); outputSchema.Add(Constants.DEFAULT_STREAM_ID, new List <Type>() { typeof(SerializableTweet) }); this.context.DeclareComponentSchema(new ComponentStreamSchema(null, outputSchema)); //TODO: Specify your twitter credentials in app.config TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["TwitterAccessToken"], ConfigurationManager.AppSettings["TwitterAccessTokenSecret"], ConfigurationManager.AppSettings["TwitterConsumerKey"], ConfigurationManager.AppSettings["TwitterConsumerSecret"]); //TODO: Setup a Twitter Stream CreateFilteredStream(); }
// On the Twitter website the user will get a captcha that he will need to enter in the application private void GenerateCredentialsAndLogin(string captcha, ITemporaryCredentials applicationCredentials) { var newCredentials = CredentialsCreator.GetCredentialsFromVerifierCode(captcha, applicationCredentials); // And now the user is logged in! TwitterCredentials.SetCredentials(newCredentials); var loggedUser = User.GetLoggedUser(); Console.WriteLine("You are logged as {0}", loggedUser.ScreenName); if (loggedUser.ScreenName != "") { CurrentStatusCount.Text = "Authorised"; accesskey.Text = newCredentials.AccessToken; accesskeySecret.Text = newCredentials.AccessTokenSecret; } else { CurrentStatusCount.Text = "Not Authorised"; accesskey.Text = ""; accesskeySecret.Text = ""; } }
private static IEnumerable <Conversation> PopulateConversationsFromFile(string fileLocation) { List <Conversation> conversations = new List <Conversation>(); var data = File.ReadAllLines(fileLocation); TwitterCredentials.SetCredentials( ConfigurationManager.AppSettings["AccessToken"], ConfigurationManager.AppSettings["AccessSecret"], ConfigurationManager.AppSettings["ConsumerKey"], ConfigurationManager.AppSettings["ConsumerSecret"]); #region getdata foreach (string s in data) { var tweetTriplet = s.Split("\t".ToCharArray()); List <ProjectTeddy.Core.EntityFramework.Tweet> tweets = new List <ProjectTeddy.Core.EntityFramework.Tweet>(); foreach (string tweetId in tweetTriplet) { long id = long.Parse(tweetId); var t = Tweetinvi.Tweet.GetTweet(id); if (t != null) { var ptTweet = InviTweetToPTTweet(t); tweets.Add(ptTweet); Console.WriteLine(ptTweet.Text); } } if (tweets.Count > 0) { Conversation c = new Conversation(); c.Tweets = tweets; conversations.Add(c); } } #endregion getdata return(conversations); }
static void Main(string[] args) { //Create the event hub var manager = Microsoft.ServiceBus.NamespaceManager.CreateFromConnectionString(ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"]); var tweethub = manager.CreateEventHubIfNotExists("TweetHubSimple"); tweetHubClient = EventHubClient.Create(tweethub.Path); var oauth = CredentialsCreator_CreateFromRedirectedCallbackURL_SingleStep(ConfigurationManager.AppSettings["twitterkey"], ConfigurationManager.AppSettings["twittersecret"]); // Setup your credentials TwitterCredentials.SetCredentials(oauth.AccessToken, oauth.AccessTokenSecret, oauth.ConsumerKey, oauth.ConsumerSecret); // Access the filtered stream var filteredStream = Tweetinvi.Stream.CreateFilteredStream(); filteredStream.AddTrack("globalazurebootcamp"); filteredStream.AddTrack("azure"); filteredStream.AddTrack("microsoft"); filteredStream.MatchingTweetReceived += (sender, a) => { Console.WriteLine(a.Tweet.Text); var str = JsonConvert.SerializeObject(new { Tweet = a.Tweet.Text, Lang = a.Tweet.Language, Created_At = a.Tweet.CreatedAt }); tweetHubClient.Send(new EventData(System.Text.Encoding.UTF8.GetBytes(str))); }; //filteredStream.JsonObjectReceived += (sender, json) => //{ // ProcessTweet(json.Json); //}; filteredStream.StartStreamMatchingAllConditions(); }
static void Main(string[] args) { TwitterCredentials.SetCredentials(TWITTERAPPACCESSTOKEN, TWITTERAPPACCESSTOKENSECRET, TWITTERAPPAPIKEY, TWITTERAPPAPISECRET); Stream_FilteredStreamExample(); }
static void Main(string[] args) { Console.Write(" *** Started ***"); TwitterCredentials.SetCredentials(TWITTERAPPACCESSTOKEN, TWITTERAPPACCESSTOKENSECRET, TWITTERAPPAPIKEY, TWITTERAPPAPISECRET); Stream_FilteredStreamExample(); }
public static void SetCredentials() { TwitterCredentials.SetCredentials(AccessToken, AccessSecret, ConsumerToken, ConsumerSecret); }