我看了一下,网页为了防抓取,都是用js来生成内容,不过还是让我找到具体位置,所有物品有3万多,需要的还要过滤,有用的只有3千多,人工来做几乎不太现实的,于是写了一个winform来抓它的信息来写到数据库中
动作在DocumentCompleted事件中完成.
private const string SQL_DATA = "select * from Table1";
private const string SQL_INSERT_1 = "insert into Table1 (WebID,Name,NeedLevel,Content) values (";
private const string Sql_INSERT_2 = ")";
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
}
private const string SQL_INSERT_1 = "insert into Table1 (WebID,Name,NeedLevel,Content) values (";
private const string Sql_INSERT_2 = ")";
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
取得物品名称和等级:
无法判断浏览器是否完成加载,所以用timer控件来完成:
timer的interval控制在1000ms,40000条数据用了11个多小时,从昨天晚上10点到今天早上,刚来的时候看到数据全都乖乖的在数据库呆着了.呵呵,搞定,交差...