低調偷偷的下別人數據
發現下出來亂碼…
用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; } }
嗯
抓緊把之前某某字幕的出的什麼電驢啊、磁力啊地址都先抓下來再說…