2016-12-27 118 views
-3

我必須從維基百科下載(例如1000)隨機文章,然後使用Html Agility Pack,從html文件/字符串中移除所有html/scripts標記。我如何下載它?有這個庫任何工具從www下載文章? 感謝您的幫助我如何從網站下載文章?

回答

1

使用可以使用WebClient。例如:

var site = new System.Net.WebClient().DownloadString("http://google.com"); 
+0

是的,但我必須從維基百科下載1000篇。例如: 我必須從URL下載文章:https://en.wikipedia.org/wiki/Sport 我必須從以下網站下載文章:https://en.wikipedia.org/wiki/Basketball 隨機1000篇文章。 – srzeppa

0

你可以寫一個爬蟲工具搶在維基百科1000個網址,並使用該HtmlWeb在HtmlAgilityPack:

string Url = "http://something"; 
HtmlWeb web = new HtmlWeb(); 
HtmlDocument doc = web.Load(Url);