Ejemplo n.º 1
0
        /// <summary>
        /// Fetches content for the specified URL and analyze it.
        /// </summary>
        /// <returns><see cref="PageData"></see> object</returns>
        /// <remarks>
        /// <p>
        /// This method fetches content from the specified URL and then analyzes it to put
        /// data into respective components like <see cref="HeaderData"></see>, <see cref="LinkDataCollection"></see> etc.
        /// inside <see cref="PageData"></see> object.
        /// </p>
        /// </remarks>
        public PageData AnalyzePage()
        {
            PageExtractor obPageExtractor = new PageExtractor(this);
            PageData      obPageData      = obPageExtractor.GetPageData();

            return(obPageData);
        }
Ejemplo n.º 2
0
        public void ExtractLinks_Should_Succeed()
        {
            var extractor = new PageExtractor();
            var pageInfo  = extractor.Extract("<link href=\"https:\\\\website.com\"");

            Assert.AreEqual(1, pageInfo.links.Count());
            Assert.AreEqual("https:\\\\website.com", pageInfo.links.First());
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            db         = new PageInfoContext();
            pExtractor = new PageExtractor();

            // Create a Timer object that knows to call our TimerCallback
            // method once every 2000 milliseconds.
            Timer t = new Timer(TimerCallback, null, 0, 10000);

            // Wait for the user to hit <Enter>
            Console.ReadLine();
        }
Ejemplo n.º 4
0
        public void ExtractContent_Should_AsExpected()
        {
            var extractor = new PageExtractor();
            var pageInfo  = extractor.Extract(@"
<html>
    <head>
        <style></style>
    </head>
    <body>
        <div>Something</div>
        <script>var abc = function()</script>
    </body>
</html>
");

            Assert.AreEqual("Something", pageInfo.content.Trim());
        }
Ejemplo n.º 5
0
 public DZoneProxy()
 {
     fetcher = new PageFetcher();
     extractor = new PageExtractor();
 }