用JS零件刮擦Booking.com

时间:2020-06-25 18:06:02

标签: python selenium-webdriver beautifulsoup phantomjs

我正在尝试访问“ hp_location_block__container” 容器中的数据,但是目前,即使使用PhantomJS,我也无法获得任何回报:

from selenium import webdriver
from bs4 import BeautifulSoup

if __name__ == '__main__':
    url = "https://www.booking.com/hotel/tz/zuri-zanzibar.html"
    driver = webdriver.PhantomJS()
    driver.get(url)
    html = driver.page_source
    soup = BeautifulSoup(html)
    
    soup.findAll("div", {"class": "hp_location_block__container "})

我得到:

Out[1]: []

0 个答案:

没有答案