The document is too complex to parse

Viewed 33

I'm currently trying to get "visit homepage" .This code below did work a few days ago. However, now when I tried it again, it gave me an error "o" is null, in which when I checked the Xpath should still work fine and the page layout doesnt seem to change at all. The page is very recent too. I tried it on another link in this same issue from other people and it also has the same issue. Is it because these websites themselves block the request?

private string VisitHomepage()
    {
        var doc = new HtmlWeb().Load("https://www.softpedia.com/get/Programming/SDK-DDK/VisioForge-Media-Player-SDK-Net-Version.shtml");
        var d = doc.DocumentNode;
        var o = d.SelectSingleNode("//dt[(@class='upcase hp')]/a"); //System.NullReferenceException: 'Object reference not set to an instance of an object.'

        return o.InnerText;
    }

I'm getting a depth level exception message here, when watching "o" properties

0 Answers
Related