我试图刮包含加载屏幕的网站。当我浏览网站时,它显示正在加载..一秒钟,然后它加载了。但问题是,当我试图刮它使用scrapy
它给我什么(可能是因为加载的原因)。我可以使用scrapy
解决这个问题吗?或者我应该使用其他一些工具吗?在这里'如果你想看https://www.graana.com/project/601/lotus-lake-towers,这是网站的链接
我试图刮包含加载屏幕的网站。当我浏览网站时,它显示正在加载..一秒钟,然后它加载了。但问题是,当我试图刮它使用scrapy
它给我什么(可能是因为加载的原因)。我可以使用scrapy
解决这个问题吗?或者我应该使用其他一些工具吗?在这里'如果你想看https://www.graana.com/project/601/lotus-lake-towers,这是网站的链接
2条答案
按热度按时间h4cxqtbf1#
x1c 0d1x由于它发送GET请求以获取有关属性的信息,您应该在代码中模仿相同的操作。(您可以在console -〉Network -〉XHR下观察GET调用)
输出是json格式的,转换成你方便的格式。
fumotvh32#
我知道这个问题是老问题,已经回答过了,但我想分享我的解决方案后,遇到了类似的问题。接受的答案对我没有帮助,因为我没有使用scrapy。
问题
抓取先显示加载页面,然后显示实际内容的网站。
下面是这样一个website的示例:
requests library不会对这样的网站起作用。根据我的经验,
request.get(URL, headers=HEADERS)
只是超时。溶液
使用Selenium。
driver.get(URL)
导航到网站后,在动画持续时间内使程序休眠。driver.page_source
安全地提取实际页面内容的HTML。Beautifulsoup
库然后可以用于解析HTML。