网页搜刮Ajax网站? [英] Web Scraping an Ajax website ?

查看:84
本文介绍了网页搜刮Ajax网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助,找到用于抓取Ajax网站的C#.Net解决方案.
所有人?

I need some help, finding a C# .Net Solution for scraping an Ajax website.
Anyone ??

推荐答案

好吧,我相信我找到了解决此问题的解决方法.
我只使用WebBrowser而不是WebClient,并让WebBrowser在提取HtmlDocument之前呈现漏洞站点.需要时间,但可以.

继承人的代码
Well i belive i found a workaround solution for this issue.
I just use the WebBrowser instead of the WebClient and have the WebBrowser render the hole site before extracting the HtmlDocument. takes time, but it works.

heres the code
public HtmlDocument GetHtmlAjax(Uri uri, int AjaxTimeLoadTimeOut)
{
    using (WebBrowser wb = new WebBrowser())
    {
        wb.Navigate(uri);
        while (wb.ReadyState != WebBrowserReadyState.Complete)
            Application.DoEvents();
        Thread.Sleep(AjaxTimeLoadTimeOut);
        Application.DoEvents();
        return wb.Document;
    }
}


这篇关于网页搜刮Ajax网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆