Beispiel #1
0
        public CrawledPage MakeRequest(Uri uri)
        {
            var result = new CrawledPage(uri)
            {
                RequestStarted         = DateTime.UtcNow,
                DownloadContentStarted = DateTime.UtcNow
            };

            AwesomiumContainer container = null;

            try
            {
                container = _awesomiumWorkerPool.GetInstance();
                DownloadedPage page = container.Download(uri.ToString());
                result.Content = new PageContent {
                    Text = page.Html
                };
            }
            finally
            {
                _awesomiumWorkerPool.ReleaseInstance(container);
                result.RequestCompleted         = DateTime.UtcNow;
                result.DownloadContentCompleted = DateTime.UtcNow;
            }

            return(result);
        }
Beispiel #2
0
        public void Dispose()
        {
            _awesomiumWorkerPool.Dispose();

            AwesomiumContainer.ShutdownDeadProcesses();
        }
Beispiel #3
0
 static AwesomiumPageRequester()
 {
     AwesomiumContainer.ShutdownDeadProcesses();
 }