是否有任何 Python 模块可以帮助从 Javascript 加载的 DOM 中抓取数据?

编程入门 行业动态 更新时间:2024-10-26 07:33:44
本文介绍了是否有任何 Python 模块可以帮助从 Javascript 加载的 DOM 中抓取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我想从使用 Ajax 调用加载 DOM 元素的页面中抓取数据.

I want to scrape data from a page which loads DOM elements using Ajax call.

我尝试过旧的基于 PyQt4 的抓取解决方案,它在完全加载后加载 DOM,但问题是我需要做一个 POST 请求,它只能用于 GET.

I have tried with the old solution line PyQt4-based scraping, which loads the DOM after it's fully loaded, but the problem is that I need to do a POST request and it's only available for GET.

新的 Python 模块 ghost.py 存在超时问题:当它获取大型 DOM 树时它引发超时异常.

The new Python module ghost.py has time out issues: when it fetches a large DOM tree it raises a time out exception.

如果有人知道任何可以帮助我执行 POST 请求并在 DOM 完全加载后获取数据的特定方式或工具,那将对我有很大帮助.

If anyone knows any specific way or tools that can help me to do a POST request and grab the data after fully loaded DOM, that will help me a lot.

推荐答案

您可以使用 Selenium 来自动化浏览器和访问多姆.Selenium 有 python 驱动程序,因此你可以用 python 编写代码来导航到页面.单击按钮并等待 ajax 调用完成,然后再开始报废.

You can use Selenium to automate browser and access dom. Selenium has python driver hence you can write code in python to navigate to the page. click buttons and wait for ajax call to complete before you start scrapping.

这篇关于是否有任何 Python 模块可以帮助从 Javascript 加载的 DOM 中抓取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 16:24:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1139242.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:可以帮助   模块   有任何   加载   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!