下载 javascript 加载的页面

发布于 2024-10-15 18:27:53 字数 416 浏览 12 评论 0原文

我正在查看的示例是 morningstar .com。 大部分内容都是通过这个javascript函数加载的。当我使用 wget 时,我没有获得浏览器中实际显示的数据(因为 wget 不解释 javascript 代码)。

有没有某种方法可以评估 javascript 并下载整个页面(使用命令行或代码)?

SRT_stocFund.LoadAComponent("sfcontent", "C", "is", "en-us","USA", "", "USA", null,{showSubTab: false});

The example I'm looking at is morningstar.com.
Most of the contents are loaded through this javascript function. When I use wget, I don't get the data that actually show up in the browser (because wget doesn't interprets javascript code).

Is there some way to evaluate the javascript and download the full page (with cmdline or code)?

SRT_stocFund.LoadAComponent("sfcontent", "C", "is", "en-us","USA", "", "USA", null,{showSubTab: false});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南汐寒笙箫 2024-10-22 18:27:53

对于该特定页面,也许您可​​以获取“导出”按钮的 URL?显然,只有当您尝试使用站点显示的实际数据时,这才有效(因为这就是摘录中的全部数据)。

以下是直接指向 .csv 文件的链接:http://financials.morningstar.com/ajax/exportKR2CSV.html?t=GOOG&culture=en_us®ion=USA&order=asc&r=765325

For that specific page, maybe you could just wget the URL of the "Export" button? Obviously this will only work if you are trying to use the actual data that the site is displaying (since that is all that is in the extract).

Here is a link directly to the .csv file: http://financials.morningstar.com/ajax/exportKR2CSV.html?t=GOOG&culture=en_us®ion=USA&order=asc&r=765325

随波逐流 2024-10-22 18:27:53

安装适用于 Firefox 的 Firebug,然后查看“网络”选项卡中的情况。这将显示 Firefox 对页面发出的所有网络请求。您可以从中复制任何 Ajax 请求的 URL(在 XHR 选项卡中),并查看响应。将 Ajax URL 提供给 wget(除非它是 POST,在这种情况下有点棘手)。

Install Firebug for Firefox, and check out what's going in the 'Net' tab. That'll show you all the network requests Firefox puts out for a page. From that you can copy the URL of any Ajax requests (in the XHR tab), and see the response. Feed the Ajax URL to wget (unless its a POST, in which case its a bit trickier).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文