trends And Tweets Properties

Sep 24, 2015 at 3:30 AM
Hey lnvi,

good day,

if you don't mind I need your help with couple of question
  1. I want to get all the trends , but after walking throw the code and trying it I see it required a place parameter , is there any way to get the trends without specifing place or at least get the user place to assign it int GetTrendsAt(place );
2.is there any way to get the tweets in trends with its properties (tweetID,User,etc).

again thanks for your well build API like this.
Coordinator
Sep 28, 2015 at 10:24 AM
Hi there,

I want to get all the trends , but after walking throw the code and trying it I see it required a place parameter , is there any way to get the trends without specifing place or at least get the user place to assign it int GetTrendsAt(place );

There are currently 3 endpoints related with trends in the Twitter REST API.

AVAILABLE
NOT IMPLEMENTED
// You can therefore use the TwitterAccessor
var trendLocations = TwitterAccessor.ExecuteGETQuery<IEnumerable<ITrendLocation>>("https://api.twitter.com/1.1/trends/available.json");
// You can also use the TwitterAccessor
var trendLocations = TwitterAccessor.ExecuteGETQuery<IEnumerable<ITrendLocation>>("https://api.twitter.com/1.1/trends/closest.json?lat=37.781157&long=-122.400612831116");
Please read these documentation and let me know what you want to do.

2.is there any way to get the tweets in trends with its properties (tweetID,User,etc).

When you have a PlaceTrend (/trends/place), you can use the Trends information to search for Tweets as followed:
var trends = Trends.GetTrendsAt(1);

var trendTermToSearch = trends.Trends.ToList()[0].Name;
var tweets = Search.SearchTweets(trendTermToSearch);
Please let me know if this answer your question as I am not sure it does.

Cheers,
Linvi
Sep 28, 2015 at 11:15 PM
Edited Sep 28, 2015 at 11:17 PM
thanks dear Linvi,

this really helped me ,also I reach a solution near to what you shared it with me as follow :
        public List<string> GetTopTrends()
        {
            var WOEID = String.Format("https://api.twitter.com/1.1/trends/available.json");
            var rWOEID = Tweetinvi.TwitterAccessor.ExecuteGETQuery<IWoeIdLocation[]>(WOEID).Where(x => x.Name == "Lebanon").Select(x => x.WoeId).First();
            var url = String.Format("https://api.twitter.com/1.1/trends/place.json?id={0}", rWOEID.ToString());
            var result = Tweetinvi.TwitterAccessor.ExecuteGETQuery<IPlaceTrends[]>(url).First();
            List<string> TrendsTopic=new List<string>() ;
            for (var i = 0; i < result.Trends.Count(); i++)
            {

                TrendsTopic.Add(result.Trends[i].Name.ToString()) ;

                }

      return TrendsTopic;
   
thanks linvi for your help