public void Analyse() { try { if (GetHtml()) { Stopwatch watch = new Stopwatch(); watch.Start(); followerResult result = SerializeHelper.DeserializeToObject <followerResult>(JSONstring); if (!result.paging.is_end) { RedisManage.AddNextUrl(result.paging.next); } foreach (var item in result.data) { RedisManage.AddUrltoken(item.url_token); } watch.Stop(); Console.WriteLine("解析json用了{0}毫秒", watch.ElapsedMilliseconds.ToString()); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
//获取用户关注列表的url private void GetUserFlowerandNext(string json) { string foollowed = "https://www.zhihu.com/api/v4/members/" + url_token + "/followers?include=data%5B*%5D.answer_count%2Carticles_count%2Cfollower_count%2Cis_followed%2Cis_following%2Cbadge%5B%3F(type%3Dbest_answerer)%5D.topics&offset=0&limit=20"; string following = "https://www.zhihu.com/api/v4/members/" + url_token + "/followees?include=data%5B%2A%5D.answer_count%2Carticles_count%2Cfollower_count%2Cis_followed%2Cis_following%2Cbadge%5B%3F%28type%3Dbest_answerer%29%5D.topics&limit=20&offset=0"; RedisManage.AddNextUrl(following); RedisManage.AddNextUrl(foollowed); }
/// <summary> /// 将关注用户的人的URL存放到nexturl中 /// </summary> /// <param name="currentPageIndex"></param> private void GetUserFollowers() { string foollowed = CommonConstant.ZHMembersRoot + url_token + "/followers?include=data%5B*%5D.answer_count%2Carticles_count%2Cfollower_count%2Cis_followed%2Cis_following%2Cbadge%5B%3F(type%3Dbest_answerer)%5D.topics&offset=0&limit=20"; RedisManage.AddNextUrl(foollowed); }
/// <summary> /// 将用户关注的人的URL存放到nexturl中 /// </summary> /// <param name="offset"></param> private void GetUserfollowing() { string following = CommonConstant.ZHMembersRoot + url_token + "/followees?include=data%5B%2A%5D.answer_count%2Carticles_count%2Cfollower_count%2Cis_followed%2Cis_following%2Cbadge%5B%3F%28type%3Dbest_answerer%29%5D.topics&limit=20&offset=0"; RedisManage.AddNextUrl(following); }