Exemple #1
0
        public List <TwitterObject> GetTwitter(string param)
        {
            string url = $"https://api.twitter.com/1.1/search/tweets.json?q={param}&result_type=recent&tweet_mode=extended&count=100";

            Auth.SetUserCredentials(ConfigurationManager.AppSettings["CustomerKey"],
                                    ConfigurationManager.AppSettings["CustomerKeySecret"],
                                    ConfigurationManager.AppSettings["AcessToken"],
                                    ConfigurationManager.AppSettings["AcessTokenSecret"]);
            var         results     = TwitterAccessor.GetQueryableJsonObjectFromGETQuery(url).ToString();
            TwitterData twitterData = JsonConvert.DeserializeObject <TwitterData>(results);

            return(twitterData.twitterData.FindAll(x => x.retweeted == null));
        }
Exemple #2
0
        // STATUS [ June 24, 2019 ]: this works
        /// <summary>
        ///     Gets JObject with all tweet info(i.e., text from tweet) from Twitter list based on searchString
        /// </summary>
        /// <remarks>
        ///     Uses tweetinvi to execute the search
        ///     Uses 'CreateSearchStringToSearchListFor' to generate search string within method
        ///     Used within 'GetJTokenOfAllTweetTextInJObject' method
        ///     See: https://github.com/linvi/tweetinvi/wiki/Custom-Queries
        /// </remarks>
        /// <param name="screenName">
        ///     The screen name / Twitter handle / user name that you want
        /// </param>
        /// <param name="listName">
        ///     The name of the list as defined by the user (e.g., 'Baseball')
        /// </param>
        /// <param name="searchString">
        ///     The term or terms that you want to search for
        /// </param>
        /// <param name="numberOfResultsToReturn">
        ///     The number of tweets you want returned
        /// </param>
        /// <example>
        ///     JObject jsonObject = GetJObjectOfTweetsFromListFiltered("mr_baseball", "baseball", "mookie", 100);
        /// </example>
        /// <returns>
        ///     JObject
        /// </returns>
        public JObject GetJObjectOfTweetsFromListFiltered(string screenName, string listName, string searchString, int numberOfResultsToReturn)
        {
            TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended;

            string fullSearchString = CreateSearchStringToSearchListFor(
                screenName,
                listName,
                searchString,
                numberOfResultsToReturn
                );

            JObject jsonObject = TwitterAccessor.GetQueryableJsonObjectFromGETQuery(fullSearchString);

            return(jsonObject);
        }