WebClient 支持 gzip, deflate
低调偷偷的下别人数据
发现下出来乱码…
用F12看看请求,原来人家是用了gzip压缩的…
试着自己加个Heading
wc.Headers.Add("Accept-Encoding", "gzip, deflate");
发现乱码依旧…
查查MSDN原来要设置HttpWebRequest.AutomaticDecompression
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.automaticdecompression.aspx
http://msdn.microsoft.com/en-us/library/system.net.decompressionmethods.aspx
新建个类继承下WebClient:
public class GZipWebClient : WebClient { protected override WebRequest GetWebRequest(Uri address) { HttpWebRequest webrequest = (HttpWebRequest)base.GetWebRequest(address); webrequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; return webrequest; } }
嗯
抓紧把之前某某字幕的出的什么电驴啊、磁力啊地址都先抓下来再说…
作者:sun8134
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。