Beispiel #1
0
 public FakeScrapeParams(string id = "505b74b57b350d1ac4b55993", string exclude = "\'\'", string include = "\'body *\'", string script = "", 
     Rectangle? bounding = null, string path = "null", List<ScrapedElement> elements = null, Resource[] resources = null, 
     string html = "http://m.mfcreativedev.com/File/a9155038-07ee-4b3a-a04a-3267e4723f96?mimeType=text/html", 
     string htmlRef = "http://m.mfcreativedev.com/File/a9155038-07ee-4b3a-a04a-3267e4723f96?mimeType=text/html",
     string url = "http://dna.ancestrydev.com/", string screenShot = null, string screenShotRef = "", 
     Size? viewportSize = null, string browser = "firefox", string browserVersion = "10", DateTime? timeStamp = null, string platform = "windows", List<string> cookies = null)
 {
     _id             = id;
     _exclude        = exclude;
     _include        = include;
     _script         = script;
     _bounding       = bounding;
     _path           = path;
     Elements        = elements;
     Resources       = resources;
     _html           = html;
     _htmlRef        = htmlRef;
     _url            = url;
     _screenShot     = screenShot;
     _screenShotRef  = screenShotRef;
     _viewportSize   = viewportSize;
     _browser        = browser;
     _browserVersion = browserVersion;
     _timeStamp      = timeStamp;
     _platform       = platform;
     _cookies        = cookies;
 }
Beispiel #2
0
        private Scrape AssembleScrape(Request request, PageData pageData, Resource[] pageResources)
        {
            var screenshotBase64 = ImageUtil.ImageToBase64(pageData.Screenshot, ImageFormat.Png);

            var scrape = new Scrape
            {
                ExcludeJquerySelector = request.ExcludeJquerySelector,
                IncludeJquerySelector = request.IncludeJquerySelector,
                BoundingRectangle     = request.BoundingRectangle,
                Script                = request.Script,
                Url                   = pageData.Url,
                TimeStamp             = DateTime.Now,
                Browser               = pageData.BrowserName.ToLower(),
                BrowserVersion        = pageData.BrowserVersion.ToLower(),
                ViewportSize          = pageData.Size,
                Platform              = pageData.Platform.ToLower(),
                Resources             = pageResources,
                Html                  = CleanHtml(pageData.Html),
                Screenshot            = screenshotBase64,
                Cookies               = pageData.Cookies.ToList()
            };

            return scrape;
        }