标签:
低调偷偷的下别人数据
发现下出来乱码…
用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; } }
嗯
抓紧把之前某某字幕的出的什么电驴啊、磁力啊地址都先抓下来再说…
标签:
原文地址:http://www.cnblogs.com/sun8134/p/4189705.html