Пример #1
0
        public void getTwitterHashtagData(string hashTag, DateTime since)
        {
            Tweets tweetsChoreo = new Tweets(session);

            // hastag search
            tweetsChoreo.setAccessToken(accessToken);
            tweetsChoreo.setQuery(hashTag);
            tweetsChoreo.setAccessTokenSecret(accessTokenSecret);
            tweetsChoreo.setConsumerSecret(consumer_secret);
            tweetsChoreo.setConsumerKey(consumer_key);
            tweetsChoreo.setCount("200");
            tweetsChoreo.setUntil(since.ToString("yyyy-MM-dd"));

            // Execute Choreo
            TweetsResultSet tweetsResults = tweetsChoreo.execute();
            //Create JSON objects
            string s_tweets = tweetsResults.Response;
            processTweeting(s_tweets, hashTag);

            JObject json_tweets = JObject.Parse(s_tweets);
            string tweet_id = (string)json_tweets["statuses"][0]["id"];

            tweetsChoreo = new Tweets(session);
            tweetsChoreo.setAccessToken(accessToken);
            tweetsChoreo.setQuery(hashTag);
            tweetsChoreo.setAccessTokenSecret(accessTokenSecret);
            tweetsChoreo.setConsumerSecret(consumer_secret);
            tweetsChoreo.setConsumerKey(consumer_key);
            tweetsChoreo.setCount("200");
            tweetsChoreo.setSinceId(tweet_id);

            tweetsResults = tweetsChoreo.execute();
            s_tweets = tweetsResults.Response;
            processTweeting(s_tweets, hashTag);
        }
Пример #2
0
        public void getTwitterHashtagData(string hashTag)
        {
            Tweets tweetsChoreo = new Tweets(session);

            // hastag search
            tweetsChoreo.setAccessToken(accessToken);
            tweetsChoreo.setQuery(hashTag);
            tweetsChoreo.setAccessTokenSecret(accessTokenSecret);
            tweetsChoreo.setConsumerSecret(consumer_secret);
            tweetsChoreo.setConsumerKey(consumer_key);
            tweetsChoreo.setCount("200");
            string tomorrow = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
            tweetsChoreo.setUntil(tomorrow);

            // Execute Choreo
            TweetsResultSet tweetsResults = tweetsChoreo.execute();

            // Print results
            //Console.WriteLine(tweetsResults.Response);
            Console.WriteLine(DateTime.Now.ToString());
            //Console.WriteLine(tweetsResults.Limit);
            //Console.WriteLine(tweetsResults.Remaining);
            //Console.WriteLine(tweetsResults.Reset);
            //Create JSON objects
            string s_tweets = tweetsResults.Response;
            processTweeting(s_tweets, hashTag);
        }