public override void ReadAllMenuURL() { try { string url = "http://ad.dabai.7lk.com/findMedication/patCategories"; string postData = "doctorId=321967&userId=321967&token=9d571f1dc32cadf0ea38"; string content = request.HttpPost(url, postData); MatchCollection ms = CommonFun.GetValues(content, "\"children\":", "\"sortable\":"); foreach (Match m in ms) { MatchCollection mMs = CommonFun.GetValues(m.Value, "{", "}"); foreach (Match mM in mMs) { string pMenuName = CommonFun.GetValue(mM.Value, "\"parent\":\"", "\""); string sMenuName = CommonFun.GetValue(mM.Value, "\"title\":\"", "\""); Console.WriteLine("pMenuName:{0}, sMenuName:{1}", pMenuName, sMenuName); string menuData = string.Format("doctorId=321967&firTitle={0}&orderBy=default&secTitle={1}&userId=321967&token=9d571f1dc32cadf0ea38", HttpUtility.UrlEncode(pMenuName), HttpUtility.UrlEncode(sMenuName)); if (!AllMenuUrl.Contains(menuData)) { AllMenuUrl.Add(menuData); } } } } catch (Exception ex) { Console.WriteLine(ex); } }
public override void ReadAllMenuURL() { string content = request.HttpGet(url); string mainMenuStr = CommonFun.GetValue(content, "nav bb1", "<div class=\"subcat-more\">"); MatchCollection ms = CommonFun.GetValues(mainMenuStr, "<div class=\"other\">", "</div>"); foreach (Match m in ms) { MatchCollection urlMs = CommonFun.GetValues(m.Value, "href=\"", "\""); foreach (Match urlM in urlMs) { if (!AllMenuUrl.Contains(urlM.Value)) { AllMenuUrl.Add(urlM.Value); } } } int startIndex = content.IndexOf("<div class=\"subcat-more\">"); int endIndex = content.LastIndexOf("<em>></em></a></div></div>"); string sumMenuStr = content.Substring(startIndex, endIndex - startIndex); MatchCollection ms1 = CommonFun.GetValues(sumMenuStr, "<a href=\"", "\""); foreach (Match m in ms1) { string tempUrl = m.Value; if (!AllItemUrl.Contains(tempUrl)) { if (!tempUrl.Contains("http")) { tempUrl = "http://www.yaofangwang.cn" + tempUrl; } AllMenuUrl.Add(tempUrl); } } }
public override void ReadAllMenuURL() { string content = request.HttpGet("http://www.hyey.cn/Drug/DrugList.aspx", "fl=2&syz=14&ypmc=盐酸多巴酚丁胺注射液"); int startIndex = content.IndexOf("item bo"); int endIndex = content.LastIndexOf("</a></em>"); content = content.Substring(startIndex, endIndex - startIndex); MatchCollection ms = CommonFun.GetValues(content, "<em><a", "</a></em>"); foreach (Match m in ms) { if (!m.Value.Contains("注射")) { string value = CommonFun.GetValue(m.Value, "href=\"", "\""); AllMenuUrl.Add(value); // Console.WriteLine("value:{0}", value); } } }