我一直在尝试制作一个工具,允许我输入关键字并让它自动执行此操作:
int.search.mywebsearch.com/mywebsearch/GGweb.jhtml?searchfor=Keyword
然后,抓取页面上的所有 URL。
但是,当我转到 regexxr 或 regex101 时,似乎网址不存在,我无法使用正则表达式来获取它。如何抓取无法使用WebClient.downloadstring(url)
下载的内容?
法典:
WebClient wc = new WebClient();
foreach(string s in Keywords)
{
string url = wc.DownloadString("https://int.search.mywebsearch.com/mywebsearch/GGmain.jhtml?&searchfor=" + s);
MatchCollection mc = Regex.Matches(url, @""); // Didn't write any regex yet
}
使用此正则表达式:
<a[^>]+hrefs?=s?"([^"]+)"[^>]?>
工作演示