我的计划是让用户在我的程序中写下电影标题,我的程序将异步提取相应的信息,以便UI不会冻结。如何在此上下文中使用WebClient.DownloadDataAsync()方法?
下面的代码:
public class IMDB
{
WebClient WebClientX = new WebClient();
byte[] Buffer = null;
public string[] SearchForMovie(string SearchParameter)
{
//Format the search parameter so it forms a valid IMDB *SEARCH* url.
//From within the search website we're going to pull the actual movie
//link.
string sitesearchURL = FindURL(SearchParameter);
//Have a method download asynchronously the ENTIRE source code of the
//IMDB *search* website.
Buffer = WebClientX.DownloadDataAsync(sitesearchURL);
//Pass the IMDB source code to method findInformation().
//string [] lol = findInformation();
//????
//Profit.
string[] lol = null;
return lol;
}
我的实际问题在于WebClientX.DownloadDataAsync()方法。我无法为它使用字符串网址。我如何使用内置函数来下载网站的字节(以备后用,我将它转换为字符串,我知道如何做到这一点),而不会冻结我的GUI?
也许是DownloadDataAsync的一个明确的例子,所以我可以学习如何使用它?
谢谢,所以你总是这么好的资源。
重新IMDB:条款页面:“机器人和屏幕抓取:您可能无法使用数据挖掘,机器人,屏幕抓取或本网站上的类似数据收集和提取工具,除非我们明确书面同意,如下所述。“。我**强烈建议**,你做**不**;这显然违反了他们的规则。 – 2009-10-18 20:53:59
Marc,还有哪些其他网站有我可以使用的IMDB等信息?谢谢您的帮助。 – 2009-10-18 21:22:17
我真的不知道。 – 2009-10-18 21:34:44