Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. node.Attributes["class"].Value
  2.  
  3. String val;
  4. if(node.Attributes["class"] != null)
  5. {
  6. val = node.Attributes["class"].Value;
  7. }
  8.  
  9. public static class HtmlAgilityExtender
  10. {
  11. public static String ValueOrDefault(this HtmlAttribute attr)
  12. {
  13. return (attr != null) ? attr.Value : String.Empty;
  14. }
  15. }
  16.  
  17. node.Attributes["class"].ValueOrDefault();
  18.  
  19. String abc = String.Empty;
  20. if (tag.Attributes.Contains(@"type"))
  21. {
  22. abc = tag.Attributes[@"type"].Value;
  23. }
  24.  
  25. String getURL(){
  26. return @"some site address";
  27. }
  28. List<string> Internalscripts()
  29. {
  30. HtmlAgilityPack.HtmlDocument doc = new HtmlWeb().Load((@"" + getURL()));
  31. //Getting All the JavaScript in List
  32. HtmlNodeCollection javascripts = doc.DocumentNode.SelectNodes("//script");
  33. List<string> scriptTags = new List<string>();
  34. foreach (HtmlNode script in javascripts)
  35. {
  36. if(!script.Attributes.Contains(@"src"))
  37. {
  38. scriptTags.Add(script.InnerHtml);
  39. }
  40. }
  41. return scriptTags;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement