/// <summary> /// 今日新闻 /// </summary> /// <returns></returns> public ActionResult TestJson() { HttpWebRequest request = HttpWebRequest.Create("http://ic.snssdk.com/2/article/
information/v6/?group_id=3492328915&context=1&iid=2296969961&device_id=2728271877&
ac=wifi&channel=hiapk&aid=13&app_name=news_article&version_code=360&device_platform=
android&device_type=Samsung%20Galaxy%20S4%20-%204.2.2%20-%20API%2017%20-%201080x1920&os_api=
17&os_version=4.2.2&openudid=e233a028a3869d01") as HttpWebRequest; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream sr = response.GetResponseStream(); string StrData = new StreamReader(sr).ReadToEnd(); JsonData data = JsonConvert.DeserializeObject<JsonData>(StrData); return View(); }
//用到的实体
#region 【(今日头条)的新闻类】 /// <summary> /// 相应的json /// </summary> public class JsonData { public string message { get; set; } public NewsData data { get; set; } } /// <summary> /// 新闻数据 /// </summary> public class NewsData { public string context { get; set; } public int bury_count { get; set; } public int user_bury { get; set; } public int ban_comment { get; set; } public int repin_count { get; set; } public string url { get; set; } public int digg_count { get; set; } public string share_url { get; set; } public string source { get; set; } public int user_repin { get; set; } public int user_digg { get; set; } public double group_id { get; set; } public int delete { get; set; } public List<label_list> label_list { get; set; } public List<related_news> related_news { get; set; } } /// <summary> /// 标签列表 /// </summary> public class label_list { public string name { get; set; } public string label { get; set; } } /// <summary> /// 相关新闻 /// </summary> public class related_news { public string group_id { get; set; } public string title { get; set; } } #endregion