您可以使用循环来遍历所有页,例如:

for i in range(1, 100):
    url = f'https://www.booking.cn/reviews/cn/hotel/crowne-plaza-chengdu.zh-cn.html?sid=7c0a78f8c1db56ee42ab9578d1032f13&customer_type=total&hp_nav=0&old_page=0&order=featuredreviews&page={i}&r_lang=zh-cn&rows=25&'
    # 执行您的代码,访问评论页面并提取数据

在这个例子中,我们使用了 range(1, 100) 来遍历从第一页到第100页的所有页数。您可以根据需要修改页数范围。

url = fhttpswwwbookingcnreviewscnhotelcrowne-plaza-chengduzh-cnhtmlsid=7c0a78f8c1db56ee42ab9578d1032f13&customer_type=total&hp_nav=0&old_page=0&order=featuredreviews&page=i&r_lang=zh-cn&rows=25& 这个酒店评

原文地址: https://www.cveoy.top/t/topic/egHW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录