# https://hotels.ctrip.com/hotels/list?starlist=5&highPrice=-1&barCurr=CNY&sort=1
from DrissionPage import ChromiumPage
dp = ChromiumPage()
url = 'https://hotels.ctrip.com/hotels/list?starlist=5&highPrice=-1&barCurr=CNY&sort=1'
# 先监听数据包
dp.listen.start('json/HotelSearch')
# 后打开网站
dp.get(url)
# 爬3页
for i in range(3):
# 等待数据包加载
resp = dp.listen.wait()
# 获取响应数据内容
data = resp.response.body
# print(data)
hotle_list = data['Response']['hotelList']['list']
for hotel in hotle_list:
print(hotel['base']['hotelName'])
# 下滑页面到底部
dp.scroll.to_bottom()