【发布时间】:2010-02-14 00:24:23
【问题描述】:
现在我正在使用这个代码:
string url = "http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=hey&esrch=FT1";
string source = getPageSource(url);
string[] stringSeparators = new string[] {
"<b>",
"</b>"
};
string[] b = source.Split(stringSeparators, StringSplitOptions.None);
bool isResultNum = false;
foreach(string s in b) {
if (isResultNum) {
MessageBox.Show(s.Replace(",", ""));
return;
}
if (s.Contains(" of about ")) {
isResultNum = true;
}
}
不幸的是它很慢,有没有更好的方法呢?像这样查询谷歌是否合法?从这个问题的答案听起来不像是How to download Google search results?
【问题讨论】: