1
在URL https://www.airbnb.com/rooms/3093543处,有一张地图加载在页面底部附近,其中包含一个表示Presidio的“邻居”框。它存储在标签为<a href="/locations/neighborhoods/479">Presidio</a>
是否可以通过请求找到此链接文本?
我想这个得到它:
profile = BeautifulSoup(requests.get("https://www.airbnb.com/rooms/3093543").content, "html.parser")
print profile.select('div[id="hover-card"]')[0].find('a').text
# div[id="hover-card"] is not found
我不知道这是可能只与检索动态变量另一个模块,或者是否有可能获得请求。
不,这是不可能的。它是动态加载的,你可以通过在浏览器中禁用javascript来检查那样的事情。试试例如硒。 –