public MtWebLst WebGetDatas(string page) { try { var request = new RestRequest("/meishi/api/poi/getPoiList", Method.GET); request.AddParameter("cityName", "绵竹"); request.AddParameter("page", page); request.AddCookie("ci", "906"); request.AddCookie("ci3", "1"); var response = client.Execute(request); var mtlst = SimpleJson.SimpleJson.DeserializeObject <MtWebLst>(response.Content); return(mtlst); } catch { UALst.First(n => n.UserAgent.Equals(client.UserAgent)).Used = true; var cua = UALst.FirstOrDefault(n => n.Used != true); if (cua != null) { client.UserAgent = cua.UserAgent; return(WebGetDatas(page)); } else { return(new MtWebLst()); } } }
public string GetDetail(string poiId = "5750537") { try { var request = new RestRequest($"/meishi/{poiId}/", Method.GET); request.AddCookie("ci", "906"); request.AddCookie("i_extend", "H__a100001__b5"); var response = client.Execute(request); var r = response.Content; var startindex = r.IndexOf("window._appState"); r = r.Substring(startindex).Replace(" ", ""); var middlestartindex = r.IndexOf("="); r = r.Substring(middlestartindex + 1); var end = r.IndexOf(";</script>"); r = r.Substring(0, end); var m = SimpleJson.SimpleJson.DeserializeObject <MtDetail>(r); return(m.detailInfo.phone); } catch { UALst.First(n => n.UserAgent.Equals(client.UserAgent)).Used = true; var cua = UALst.FirstOrDefault(n => n.Used != true); if (cua != null) { client.UserAgent = cua.UserAgent; return(GetDetail(poiId)); } else { return(""); } } }
public MtMobileLst MobileGetDatas(int offset) { try { client.BaseUrl = new Uri("http://meishi.meituan.com"); var request = new RestRequest("/i/api/channel/deal/list", Method.POST); request.AddCookie("ci", "906"); var payload = new FormParam() { areaId = 0, cateId = 1, deal_attr_23 = "", deal_attr_24 = "", deal_attr_25 = "", limit = 15, lineId = 0, offset = offset, poi_attr_20033 = "", poi_attr_20043 = "", sort = "default", stationId = 0 }; request.AddJsonBody(payload); var response = client.Execute(request); var mtlst = SimpleJson.SimpleJson.DeserializeObject <MtMobileLst>(response.Content); return(mtlst); } catch { UALst.First(n => n.UserAgent.Equals(client.UserAgent)).Used = true; var cua = UALst.FirstOrDefault(n => n.Used != true); if (cua != null) { client.UserAgent = cua.UserAgent; return(MobileGetDatas(offset)); } else { return(new MtMobileLst()); } } }