예제 #1
0
        public List <Models.Trend> GetTrends()
        {
            var modelTrend = new List <Models.Trend>();

            var result = Auth.ExecuteOperationWithCredentials(_credentialService.GetUserCredentials(), () =>
            {
                var trends = Trends.GetTrendsAt(44418);

                var newTrends          = trends.Trends;
                IEnumerator <ITrend> e = newTrends.GetEnumerator();
                int ok = 0;
                while (e.MoveNext() && ok < 10)
                {
                    List <Models.Tweet> tweets = SearchTweet(e.Current.Name);

                    modelTrend.Add(new Models.Trend()
                    {
                        Name            = e.Current.Name,
                        URL             = e.Current.URL,
                        Query           = e.Current.Query,
                        PromotedContent = e.Current.PromotedContent,
                        TweetVolume     = e.Current.TweetVolume,
                        Tweet           = tweets
                    });
                    ok++;
                }
                return(modelTrend);
            });

            return(result);
        }
예제 #2
0
 public IPlaceTrends GetTrends()
 {
     try
     {
         var Indo  = new Coordinates(112.71917, -7.27683);
         var tweet = Auth.ExecuteOperationWithCredentials(_creds, () =>
         {
             var allLoc = Trends.GetAvailableTrendLocations();
             foreach (var loc in allLoc)
             {
                 if (loc.CountryCode == "ID")
                 {
                     return(Trends.GetTrendsAt(loc.WoeId));
                 }
             }
             return(Trends.GetTrendsAt(23424846));
             //return Trends.GetTrendsAt(56000318);
         });
         return(tweet);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
예제 #3
0
        public bool postTrend(string token2)
        {
            long[] paises = new long[20];
            paises[0]  = 23424768;
            paises[1]  = 23424782;
            paises[2]  = 23424787;
            paises[3]  = 23424801;
            paises[4]  = 23424919;
            paises[5]  = 23424768;
            paises[6]  = 23424762;
            paises[7]  = 468052;
            paises[8]  = 23424762;
            paises[9]  = 1;
            paises[10] = 4;
            paises[11] = 123;
            paises[12] = 2;
            paises[13] = 3;
            paises[14] = 5;
            paises[15] = 6;
            paises[16] = 7;
            paises[17] = 8;
            paises[18] = 9;
            paises[19] = 1;

            foreach (var woeid in paises)
            {
                var trends = Trends.GetTrendsAt(woeid);
                if (trends != null)
                {
                    var tweets  = Search.SearchTweets(trends.Trends[0].Name);
                    var tweets2 = Search.SearchTweets(trends.Trends[1].Name);

                    if (tweets != null)
                    {
                        if (tweets.First().FullText.StartsWith("RT"))
                        {
                            var postTweet = Tweetinvi.Tweet.PublishRetweet(tweets.First());
                        }
                        else
                        {
                            var postTweet = Tweetinvi.Tweet.PublishTweet(tweets.First().FullText);
                        }
                    }
                    if (tweets2 != null)
                    {
                        if (tweets2.First().FullText.StartsWith("RT"))
                        {
                            var postTweet2 = Tweetinvi.Tweet.PublishRetweet(tweets2.First());
                        }
                        else
                        {
                            var postTweet2 = Tweetinvi.Tweet.PublishTweet(tweets2.First().FullText);
                        }
                    }
                }
            }
            return(true);
        }
예제 #4
0
        /// <summary>
        /// Recoge y muestra los trendings de la localización
        /// pasada por parámetro
        /// </summary>
        /// <param name="location">Int correspondiente al WOEID de una localización</param>
        private void setTrendigns(int location)
        {
            int i = 0;

            //Extrae los trendings
            var trends = Trends.GetTrendsAt(location);

            //Recorre objetos correspondientes a TextBlock y les pone las trends en orden
            foreach (TextBlock dr in grd_TL.Children)
            {
                dr.Text = (i + 1) + "º " + trends.Trends.ToList()[i].Name;
                i++;
            }
        }
예제 #5
0
 public void FetchTwitterTrends()
 {
     try
     {
         _logger.Info("Fetching top Twitter trends..");
         var details = Trends.GetTrendsAt(1).Trends.Select(t => t.Name);
         _fileManager.SaveFile(details, _trendFilePath, true);
     }
     catch (Exception ex)
     {
         _logger.Info(ex.Message);
         return;
     }
 }
예제 #6
0
        public IPlaceTrends GetTrendsFromPlace(long woeid, APIDetails details)
        {
            try
            {
                // Get a AuthenticatedUser from a specific set of credentials
                Auth.SetUserCredentials(details.ApiKey, details.ApiSecretKey, details.AccessToken, details.AccessTokenSecret);

                var trends = Trends.GetTrendsAt(woeid);
                return(trends);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #7
0
        public HttpResponseMessage conseguirSeguidores(string conseguirSeguidores)
        {
            long[] paises = new long[13];
            paises[0]  = 23424768;
            paises[1]  = 23424782;
            paises[2]  = 23424787;
            paises[3]  = 23424801;
            paises[4]  = 23424919;
            paises[5]  = 23424768;
            paises[6]  = 23424762;
            paises[7]  = 468052;
            paises[8]  = 23424762;
            paises[9]  = 1;
            paises[10] = 23424950;
            paises[11] = 615702;
            paises[12] = 44418;
            IAuthenticatedUser usAut = Tweetinvi.User.GetAuthenticatedUser();

            foreach (var woeid in paises)
            {
                var trends = Trends.GetTrendsAt(woeid);
                if (trends != null)
                {
                    var tweets  = Search.SearchTweets(trends.Trends[0].Name);
                    var tweets2 = Search.SearchTweets(trends.Trends[1].Name);
                    var tweets3 = Search.SearchTweets(trends.Trends[2].Name);

                    if (tweets != null)
                    {
                        usAut.FollowUser(tweets.First().CreatedBy.ScreenName);
                    }
                    if (tweets2 != null)
                    {
                        usAut.FollowUser(tweets2.First().CreatedBy.ScreenName);
                    }
                    if (tweets3 != null)
                    {
                        usAut.FollowUser(tweets3.First().CreatedBy.ScreenName);
                    }
                }
            }
            return(null);
        }
예제 #8
0
        /// <summary>
        /// Returns all of the trends near a given latitude and longitude
        /// </summary>
        /// <param name="latitude"></param>
        /// <param name="longitude"></param>
        public List <ITrend> TrendingTweets(double latitude, double longitude)
        {
            var list = new List <ITrend>();
            var closestTrendLocations = Trends.GetClosestTrendLocations(latitude, longitude);

            foreach (var item in closestTrendLocations)
            {
                var trends = Trends.GetTrendsAt(item.WoeId).Trends;

                foreach (var trend in trends)
                {
                    if (!list.Contains(trend))
                    {
                        list.Add(trend);
                    }
                }
            }

            return(list);
        }
 public ITrend[] GetTrends(int id)
 {
     if (ISScontext != null)
     {
         var closestTrendLocations = Trends.GetClosestTrendLocations(ISScontext[id].lat, ISScontext[id].lng);
         if (closestTrendLocations != null)
         {
             var woe = closestTrendLocations.ElementAt(0).WoeId;
             try
             {
                 var trendingTopics = Trends.GetTrendsAt(woe);
                 return(trendingTopics.Trends.ToArray());
             }
             catch (NullReferenceException)
             {
                 return(null);
             }
         }
         return(null);
     }
     return(null);
 }
예제 #10
0
        public List <string> getTrendingTweets()
        {
            int place  = 2379574;
            var trends = Trends.GetTrendsAt(place);

            var           trendTermToSearch = trends.Trends.ToList();
            List <string> trendingTopics    = new List <string>();

            foreach (var topic in trendTermToSearch)
            {
                if (topic.Name.StartsWith("#"))
                {
                    string topicNoHash = topic.Name.Remove(0, 1);
                    trendingTopics.Add(topicNoHash);
                }
                else
                {
                    trendingTopics.Add(topic.Name);
                }
            }
            return(trendingTopics);
        }
예제 #11
0
 public ObservableCollection <TwitterTrend> getTrends(string woeid)
 {
     return(helper.CollectTrend(Trends.GetTrendsAt(Convert.ToInt64(woeid))));
 }
예제 #12
0
 /// <summary>
 /// Returns trending topics for a specified WOEID (Where On Earth Identifier)
 /// </summary>
 /// <param name="woeId"></param>
 public List <ITrend> TrendingTweets(long woeId)
 {
     return(Trends.GetTrendsAt(woeId).Trends);
 }
예제 #13
0
 /// <summary>
 /// Return trending topics on the Earth.
 /// </summary>
 public List <ITrend> TrendingTweets()
 {
     return(Trends.GetTrendsAt(1).Trends);
 }
예제 #14
0
        public HttpResponseMessage Get(string location)
        {
            //Tweetinvi.Auth.
            if (location == "")
            {
                location = "Argentina";
            }
            long woeid = 468052;

            switch (location)
            {
            case "Argentina":
                woeid = 23424747;
                break;

            case "Brasil":
                woeid = 23424768;
                break;

            case "Chile":
                woeid = 23424782;
                break;

            case "Colombia":
                woeid = 23424787;
                break;

            case "Ecuador":
                woeid = 23424801;
                break;

            case "Peru":
                woeid = 23424919;
                break;

            case "Bolivia":
                woeid = 23424762;
                break;

            case "Uruguay":
                woeid = 468052;
                break;

            case "Paraguay":
                woeid = 23424762;
                break;

            case "Us":
                woeid = 1;
                break;

            case "España":
                woeid = 23424950;
                break;

            case "Francia":
                woeid = 615702;
                break;

            case "Inglaterra":
                woeid = 44418;
                break;

            case "Venezuela":
                woeid = 23424762;
                break;
            }


            var trends = Trends.GetTrendsAt(woeid);

            List <String> tendencias = new List <string>();
            int           i          = 1;

            if (trends != null)
            {
                foreach (var ten in trends.Trends)
                {
                    tendencias.Add(ten.Name);
                    i++;
                    if (i > 20)
                    {
                        break;
                    }
                }
            }
            else
            {
                tendencias.Add("No hay tendencias para ese Pais");
            }
            return(Request.CreateResponse(tendencias));
        }
예제 #15
0
        public ActionResult HashtagsAnalysis()
        {
            var t = Trends.GetTrendsAt(23424848);

            return(View(t.Trends));
        }