使用C#的Jquery Ajax网页抓取 [英] Jquery Ajax Web page scraping using c#

查看:60
本文介绍了使用C#的Jquery Ajax网页抓取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用c#.net 3.5应用程序抓取网页,但由于某些内容通过jquery Ajax显示,因此我无法抓取整页.

I try to scrap a webpage using c#.net 3.5 application but i am not able to scrap full page because some content showing via jquery Ajax.

看到此

这是我的代码

 private void button1_Click(object sender, EventArgs e)
    {
        string url = "http://www.racingpost.com/greyhounds/result_home.sd#resultDay=2012-12-16&meetingId=18&isFullMeeting=true";

        WebClient w = new WebClient();
        string s = w.DownloadString(url);


    }

我需要我认为由Ajax显示的网站的比赛结果.

i need the race result from the website which is show by Ajax i think.

推荐答案

http://www.racingpost.com/greyhounds/result_by_meeting_full.sd?r_date=2012-12-16&meeting_id=18

如果您将Chrome用于网络浏览器,则可以打开开发人员工具(F12),然后在网络"标签中查看以查看页面加载后需要哪些资源.上面的URL是我发现似乎可以带来一些结果的URL之一.如果您知道或可以解析date和Meeting_id,则可能可以像在主页上一样直接拨打电话.

If you use Chrome for your web browser, you can open up developer tools (F12) and look in the "Network" tab to see what resources are requested after the page loads. The above URL is one of the ones I noticed seems to pull some results. If you know or can parse date and meeting_id you could probably make calls directly as you are with the main page.

另一个可能的选择是使用实际的网络浏览器控件并在所有内容加载完成后扫描DOM.

Another possible option is using an actual web browser control and scanning the DOM after everything has finished loading.

这篇关于使用C#的Jquery Ajax网页抓取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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