示例#1
0
 public static string GetTitle(this HtmlDocument doc)
 {
     if (doc.CheckNode("//meta[@name='title']"))
     {
         return(doc.GetNode("//meta[@name='title']"));
     }
     if (doc.CheckNode("//meta[@name='twitter:title']"))
     {
         return(doc.GetNode("//meta[@name='twitter:title']"));
     }
     return("");
 }
示例#2
0
 public static string GetDescription(this HtmlDocument doc)
 {
     if (doc.CheckNode("//meta[@name='description']"))
     {
         return(doc.DocumentNode.SelectSingleNode("//meta[@name='description']").Attributes["content"].Value);
     }
     if (doc.CheckNode("//meta[@name='twitter:description']"))
     {
         return(doc.DocumentNode.SelectSingleNode("//meta[@name='twitter:description']").Attributes["content"]
                .Value);
     }
     return("");
 }
示例#3
0
 public static string GetThumbnailUrl(this HtmlDocument doc)
 {
     if (doc.CheckNode("//meta[@property='og:image']"))
     {
         return(doc.DocumentNode.SelectSingleNode("//meta[@property='og:image']").Attributes["content"].Value);
     }
     return("");
 }