Exemple #1
0
 public LinkedList <FileNameRepresentation> Analyze()
 {
     Console.WriteLine("\n\n**INFO**: Starting Wiki Analysis");
     Console.WriteLine("================================");
     AnalyzeWiki();
     if (DeducedFileNames.Any())
     {
         Console.WriteLine($"\n\n**SUCCESS**: {DeducedFileNames.Count} potential file names registered."); //Todo kann auch 0 sein....
     }
     else
     {
         Console.WriteLine("\n\n**ERROR**: No potential file names were found. Was the URL wrong?");
     }
     return(DeducedFileNames);
 }
Exemple #2
0
        private void AnalyzeWiki()
        {
            HtmlWeb      web = new HtmlWeb();
            HtmlDocument wikiDocument;

            wikiDocument = web.Load(new Uri(WikiURL));
            wikiDocument.OptionUseIdAttribute = true;


            var h2Nodes = wikiDocument.DocumentNode.SelectNodes("//h2");

            AnalyzeByHeadings(h2Nodes);

            if (!DeducedFileNames.IsEmpty())
            {
                return;
            }

            Console.WriteLine("\n**WARN**: Analysis for dedicated episode page failed... trying attempt for a non dedicated episode list page...");
            var h2Head = wikiDocument.DocumentNode.SelectSingleNode("//h2[contains(.,'Episodenliste')]");

            if (h2Head is null)
            {
                h2Head = wikiDocument.DocumentNode.SelectSingleNode("//h2[contains(.,'Episoden')]");
            }

            if (h2Head != null)
            {
                var h3Nodes = h2Head.SelectNodes("./following-sibling::h3");
                if (!(h3Nodes is null))
                {
                    AnalyzeByHeadings(h3Nodes);
                }
                else
                {
                    Console.WriteLine($"\n**WARN**: No h3 Headings after H2-Heading 'Episoden(liste)' at line {h2Head.Line}. Skipping attempt...");
                }
            }