这是我通过URL下载文件的代码,但是我想让我的下载管理器自动捕获链接
private void button1_Click_1(object sender, EventArgs e)
{
WebClient client = new WebClient();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
string []filename;
string fn ; fn=textBox1.Text;
int i;
filename =fn.Split('/');
for (i = 1; i <= filename.Length; i++) ;
string oname=filename[i-2];
//////// Starts the download
client.DownloadFileAsync(new Uri("http://dinirah.wen.ru/Internet-k-zariye-musalmano-gumrah-kia-ja-raha.mp3"), textBox2.Text+"\\"+oname);
//////// the above i passed the url to download.
label4.Text = i.ToString();
button1.Text = "Download In Process";
button1.Enabled = false;
}
现在,我想让下载程序自动获取下载URL,并将其存储在字符串中,然后将其作为URL传递。
最佳答案
您应该开发浏览器扩展,然后才能截获文件下载过程。
另一种方法是监视计算机的网络连接,并在请求所需文件类型时进行拦截。我发现IDM会拦截我的下载内容,即使我正在使用程序进行下载(如果在IDM中启用了拦截任何下载的功能)。注意Windows更新文件,诊断文件和任何其他未知文件。