有没有办法用 python beautifulsoup 或 lxml 不使用 selenium 来抓取 JS 渲染的网页?
谢谢
最佳答案
你可以使用 requests_html 模块作为替代,它非常简单
from bs4 import BeautifulSoup
import requests
resp = requests.get("https://stackexchange.com/sites")
html = resp.content
soup = BeautifulSoup(html)
option_tags = soup.find_all("option")
如果您想更深入地了解它,只需谷歌该模块
关于python - 有没有办法在 python 中抓取没有 Selenium 的 JavaScript 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64119236/
相关文章:
javascript - 如何在 React Native 中更改原生 Picker fontSiz
python - 在嵌套/平面字符串和整数列表中查找超过 10 的最小数字
java - 如何将上下文传播到 Project Reactor 中的下游运算符?
c# - 无法在启动类中注入(inject)IAntiforgery
firebase - 使用带有 Flutter Web App 的 http 包发布到 Cloud
javascript - 来自 firebase 的图像的 html2canvas jsPdf 访问