Example #1
0
        /// <summary>
        ///     返回最近一小时内的热门话题。
        /// </summary>
        /// <param name="baseApp">是否基于当前应用来获取数据。true表示基于当前应用来获取数据。 </param>
        /// <returns></returns>
        public HotTrends Hourly(bool baseApp = false)
        {
            var json = JObject.Parse(api.Hourly(baseApp));

            var result = new HotTrends();

            result.AsOf   = json["as_of"].ToString();
            result.Trends = new Dictionary <string, List <Keyword> >();
            foreach (JProperty x in json["trends"])
            {
                var            name = x.Name;
                List <Keyword> list = null;
                if (result.Trends.ContainsKey(name))
                {
                    list = result.Trends[name];
                }
                else
                {
                    list = result.Trends[name] = new List <Keyword>();
                }

                foreach (JObject item in x.Value)
                {
                    list.Add(new Keyword
                    {
                        Name   = string.Format("{0}", item["name"]),
                        Query  = string.Format("{0}", item["query"]),
                        Amount = string.Format("{0}", item["amount"]),
                        Delta  = string.Format("{0}", item["delta"])
                    });
                }
            }

            return(result);
        }
Example #2
0
 /// <summary>
 ///     返回最近一小时内的热门话题。
 /// </summary>
 /// <param name="baseApp">是否基于当前应用来获取数据。true表示基于当前应用来获取数据。 </param>
 /// <returns></returns>
 public dynamic Hourly(bool baseApp = false)
 {
     return(DynamicJson.Parse(api.Hourly(baseApp)));
 }