我是網站scraping,使用Python
和BeautifulSoap
。無法使用BeautifulSoap報廢內容
我得刮這個頁面。
http://www.starwoodhotels.com//sheraton/property/reviews/index.html?language=en_US&propertyID=115
在此頁面中,我已經刮掉酒店的地址成功,但是我不能刮網友評論部分
這裏是我的代碼
hotel_link = "http://www.starwoodhotels.com//sheraton/property/reviews/index.html?language=en_US&propertyID=115"
hotel_page_html = requests.get(hotel_link,headers = header).text
hotel_page_soup = BeautifulSoup(hotel_page_html)
for hotel_address in hotel_page_soup.select("div#propertyAddressContainer ul#propertyAddress"):
print("Address: "+hotel_address.select("li")[0].text)
print(hotel_page_soup.select("div.BVRRRatingNormalOutOf"))
,你可以看到,使用CSS選擇器div#propertyAddressContainer ul#propertyAddress
,我已經得到了地址,但無法抓取User Reviews
部分。
我在頁面加載時檢查了Console
,但沒有看到用戶評論通過AJAX調用加載的任何內容。
那麼如何刮評論部分?
複製? http://stackoverflow.com/a/5913539/2063058 http://stackoverflow.com/questions/2610112/beautifulsoup-and-mechanize-to-get-ajax-call-result – tiktok
我需要看看哪些是URl提取評論?我在頁面中搜索了HTML但找不到它。有人可以告訴我的網址? – Umair
http://stackoverflow.com/a/5995713/2063058 – tiktok