Reputation: 3
I'm trying to automatically download a subtitle file from www.addic7ed.com but when I try to do this:
WebClient t = new WebClient();
t.DownloadFile(@"http://www.addic7ed.com/updated/1/80504/0",
@"C:\Users\Marcelo\Documents\Proyectos\Subtitulos\Subs1.srt");
It downloads the source code from the webpage.
If I try to access "http://www.addic7ed.com/updated/1/80504/0", it redirects me to the "select your download page".
However it is the hyperlink for such download. I think that the page detects if I am actually clicking the button or if I just have the link.
Upvotes: 0
Views: 1328
Reputation: 19154
to download file it require referer header, try add
t.Headers.Add("Referer","http://www.addic7ed.com/serie/Modern%20Family/5/6/addic7ed");
Upvotes: 0
Reputation: 29981
WebClient
is working just fine. The behavior you're experiencing is part of the website.
The URL you're accessing sounds like a download site? It probably expects some cookies or headers to be set from a previous page to give you access to the full file. Maybe use Fiddler to figure out the traffic created by your browser and try to emulate it.
Upvotes: 3