提取html时是否有解决隐私政策的方法?

时间:2019-12-28 20:02:52

标签: c#

简单的HTML提取程序,但是有时在抓取网站时(例如,下面所述的我知道的YES是假的)!该程序改为提取隐私政策;有没有办法解决?在其他程序上效果很好

string urlAddress = @"https://anyavien.com/how-to-use-rosemary-to-improve-memory-by 75/"; 
string BaseHTML = "";

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress);

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

if (response.StatusCode == HttpStatusCode.OK)
{
    Stream receiveStream = response.GetResponseStream();
    StreamReader readStream = null;

    if (response.CharacterSet == null)
    {
        readStream = new StreamReader(receiveStream);
        Console.WriteLine("Error"); //make skip this link if error
    }
    else
    {
        readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
        readStream.ToString();
        //Console.WriteLine(readStream);
    }

    string ImpureChtml = readStream.ReadToEnd().ToString();
    HtmlofEachC.Add(ImpureChtml);
    //  Console.WriteLine(ImpureChtml);
    Console.WriteLine("----------Extracted HTML From Links-----------------------                         -");
    Console.WriteLine("----------------------------------");
}

0 个答案:

没有答案