在C#.NET中,是否有一种方法可以从ajax网页中抓取动态数据? [英] In C# .NET, is there a way to scrape dynamic data from an ajax web page?

查看:51
本文介绍了在C#.NET中,是否有一种方法可以从ajax网页中抓取动态数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想调查一个不断更新动态数据的网页,然后抓取这些数据.我不想每秒重新加载整个页面.有没有办法在不重新加载页面的情况下获取这些数据?

I'd love to poll a web page that has constantly updating dynamic data, and grab that data. I don't want to reload the entire page every second. Is there way to grab that data without reloading the page?

出于演示目的,我正在将其编码为控制台应用程序.

I'm coding as a console app for demo purposes.

非常感谢!

推荐答案

不是.对于初学者来说,HTTP是无状态的.执行HTTP请求时,即使使用动态例程生成静态数据,也始终会取回静态数据.

Not really. For starters, HTTP is stateless. When you perform an HTTP request, you'll always get static data back, even if dynamic routines were used to generate it.

听起来好像您无法以任何其他方式(即直接链接到DB,Web服务等)访问用于构造页面的数据-如果可以的话,您将不会抓取网页.

Doesn't sound like you can hit the data used to construct the page in any other way ( i.e. direct link into DB, Web service, etc ) - if you could you wouldn't be scraping web pages.

即使您可以做到,也不会有太大的不同.您仍然需要将您现在拥有的数据与远程服务拥有的数据进行比较.缺少某种推送通知,您正在轮询;如果要轮询,是的,您必须一直检查.

Even if you could do that, wouldn't make much of a difference. You're still going to have to compare what you have now with the data the remote service has. Absent some sort of push notification, you're polling, and if you're polling, yes, you have to check all the time.

这篇关于在C#.NET中,是否有一种方法可以从ajax网页中抓取动态数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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