[C#] 纯文本查看 复制代码 private string GetHttpBaiDuSearch()
{
SufeiUtil.HttpHelper http = new SufeiUtil.HttpHelper();
SufeiUtil.HttpItem item = new SufeiUtil.HttpItem()
{
URL = "https://www.baidu.com/s?wd=%E4%BB%BB%E6%84%8F%E5%85%B3%E9%94%AE%E5%AD%97",
Method = "GET",
Host = "www.baidu.com",
UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
};
item.Header.Add("Sec-Fetch-User","?1");
item.Header.Add("Sec-Fetch-Site","none");
item.Header.Add("Sec-Fetch-Mode","navigate");
item.Header.Add("Accept-Encoding","gzip, deflate, br");
item.Header.Add("Accept-Language","zh-CN,zh;q=0.9");
SufeiUtil.HttpResult result = http.GetHtml(item);
string html = result.Html;
return html;
}
|