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); }
//Search Twitter for youtube videos to determine how many times they've been shared. public int getTWYTVideoShares(string video_id) { Tweets tweetsChoreo = new Tweets(session); // Set inputs tweetsChoreo.setAccessToken(accessToken); tweetsChoreo.setQuery("https://www.youtube.com/watch?v="+video_id); tweetsChoreo.setAccessTokenSecret(accessTokenSecret); tweetsChoreo.setConsumerSecret(consumer_secret); tweetsChoreo.setConsumerKey(consumer_key); // Execute Choreo TweetsResultSet tweetsResults = tweetsChoreo.execute(); JObject jo = JObject.Parse(tweetsResults.Response); try { JArray ja = (JArray)jo["statuses"]; return ja.Count; } catch (Exception e) { return 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); }