void start() { if (inx > urls.Count - 1) { timer1.Stop(); label1.Text = "好了"; return; } if (urls[inx].Trim() == "") { inx++; return; } label1.Text = "正在抓第" + (inx + 1) + "个页面 "; isCatching = true; pics = new List <string>(); names = new List <string>(); string html = HttpSend.getSend(urls[inx], "", null, "UTF-8"); inx++; Regex a = new Regex("style=\"background:url\\((\\S+)_\\S+\\)"); Regex b = new Regex("<a\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+>\\s+<span>(\\S+)</span>\\s+</a>"); /*pic path*/ MatchCollection mcs = a.Matches(html); foreach (Match item in mcs) { if (item.Success) { pics.Add("http:" + item.Groups[1].Value + ""); } } /*name*/ MatchCollection NameMcs = b.Matches(html); foreach (Match item in NameMcs) { if (item.Success) { names.Add("" + item.Groups[1].Value + ""); } } }
public static string getSend(string url, string param) { return(HttpSend.getSend(url, param, null, "UTF-8")); }