Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Update your browser | Facebook message

$
0
0
Hi,

I am new to HtmlAgilityPack, and was told to load the meta data by using HtmlAgilityPack, this works perfect. But the issue I have to face, is that when loading the major websites such as Google and Facebook, their description isn't shown and their title is different. For Facebook it is Update your browser | Facebook.

How to prevent this? I mean what type of browser is used to load the data? I have recently downloaded the pack from NuGet gallery, so which means this is latest. And the code I am using is ow to prevent this? I mean what type of browser is used to load the data? I have recently downloaded the pack from NuGet gallery, so which means this is latest. And the code I am using is
@using HtmlAgilityPack;
@{
    Layout = "~/_SiteLayout.cshtml";
    var Title = "";
    var Description = "";
    using(var client = new WebClient()){
        var html = client.DownloadString("http://www.facebook.com");
        var doc = new HtmlDocument();
        doc.LoadHtml(html);
        var title = doc.DocumentNode.Descendants("title").FirstOrDefault();
        if(title != null){
            Title = title.InnerText;
        }
        var description = doc.DocumentNode.Descendants("meta")
                                          .Where(n => n.GetAttributeValue("name", String.Empty)
                                          .Contains("description")).FirstOrDefault();
        if(description != null){
            Description = description.GetAttributeValue("content", string.Empty);
        }
    }
}
Any guidance?

Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>