コード例 #1
0
ファイル: Program.cs プロジェクト: GabeStah/Airbrake.io
 static void ParseTest(string uri)
 {
     try
     {
         // Generate document using AngleSharp.
         var document = WebParser.GetHtmlDocument(uri);
         // Get all h1 and h2 headers from document, concat into single
         // collection, and then get TextContent and insert into array.
         var headers = document.QuerySelectorAll("h1")
                       .Concat(document.QuerySelectorAll("h2"))
                       .Select(element => element.TextContent)
                       .ToArray();
         // Output title and headers to test if connection was successful.
         Logging.Log($"Title: {document.Title}");
         Logging.Log("Headers:");
         Logging.Log(headers);
     }
     catch (System.Net.WebException exception)
     {
         Logging.Log(exception);
     }
     catch (Exception exception)
     {
         Logging.Log(exception, false);
     }
 }
コード例 #2
0
        static void ParseTest(string uri)
        {
            // Generate document using AngleSharp.
            var document = WebParser.GetHtmlDocument(uri);
            // Get all h1 and h2 headers from document, concat into single
            // collection, and then get TextContent and insert into array.
            var headers = document.QuerySelectorAll("tr.vevent td:nth-child(3)").Select(element => element.TextContent).ToArray();

            // Output title and headers to test if connection was successful.

            foreach (var header in headers)
            {
                Console.WriteLine(header);
            }
        }