110,532
社区成员
发帖
与我相关
我的任务
分享
try
{
string html = webBrowser1.Document.Body.InnerHtml;
MatchCollection matches = Regex.Matches(html, @"http://[-.a-z0-9_]{4,20}\.blog\.163\.com/|http://blog\.163\.com/[-.a-z0-9@_]{4,25}/");
foreach (Match match in matches)
{
string blog = match.ToString();
this.dbinsert(blog);
}
//SHDocVw.WebBrowser wb = this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser;
//wb.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(wb_NavigateComplete2);
if (html.Contains("<A class=Next onclick=\"MembersListForm.dataPageManager.clickNext(); return false;\""))
{
////MessageBox.Show("包含");
//this.webBrowser1.Document.InvokeScript("nb.p['m-62'].g.pu", new string[] { "1" });
for (int i = 0; i < webBrowser1.Document.All.Count; i++)
{
string tagname = webBrowser1.Document.All[i].TagName.ToString().ToLower();
if (tagname == "a")
{
string str = webBrowser1.Document.All[i].OuterHtml;
if (str.Contains("<A class=Next onclick=\"MembersListForm.dataPageManager.clickNext(); return false;\""))
{
webBrowser1.Document.All[i].InvokeMember("click");//引发”CLICK”事件
GC.Collect();
GC.WaitForPendingFinalizers();
//webBrowser1.Document.All[i - 1].InvokeMember("click");//引发”CLICK”事件
break;
}
}
}
this.timer1.Start();
}
else
{
webBrowser1.Navigate(dbblog());
}
}
catch (Exception)
{
this.Form1_Load(sender, e);
}