Моя задача — извлечь комментарии с сайта booking.com, ссылка указана как Отель Тбилиси Тауэр
Я хочу извлечь комментарии с разных страниц, а именно если нажать прочитать все отзывы , мы видим, что существует более 300 страниц, и с каждой страницы я могу извлекать комментарии, я написал следующий код:
from bs4 import BeautifulSoup
import requests
url ='https://www.booking.com/hotel/ge/tbilisi-tower-tbilisi.en-gb.html?aid=339738&label=tbilisi-9HByUQ9gPsLl56jk1ktJYAS388385943105%3Apl%3Ata%3Ap11820%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-90146752673%3Alp9198877%3Ali%3Adec%3Adm%3Appccp%3DUmFuZG9tSVYkc2RlIyh9YU5pXiVhsEsYF5VzKbQXpIg&sid=1c94570f144a332c36feeee1d46bcbe0&all_sr_blocks=534523702_210668006_2_1_0&checkin=2024-12-20&checkout=2024-12-21&dest_id=900047975&dest_type=city&dist=0&group_adults=2&group_children=0&hapos=1&highlighted_blocks=534523702_210668006_2_1_0&hpos=1&matching_block_id=534523702_210668006_2_1_0&no_rooms=1&req_adults=2&req_children=0&room1=A%2CA&sb_price_type=total&sr_order=popularity&sr_pri_blocks=534523702_210668006_2_1_0__18176&srepoch=1734279281&srpvid=b491722d29710489&type=total&ucfs=1&#tab-main'
content =requests.get(url).text
content =BeautifulSoup(content,'html.parser')
print(content.find_all("div",class_='a53cbfa6de b5726afd0b'))
print("here is full messages :")
for message in content.find_all("div",class_='a53cbfa6de b5726afd0b'):
print(message.text)
“Good room for family, with connecting door. Room is clean.
Staffs are helpful, breakfast is good. Location is good. Food from bar restaurant is good taste.”
“Amazing rooms, lovely staff and peaceful! Felt safe too !”
“ძაალიან სასიამოვნო გარემო , მოწესრიგებული და ყურადღებიანი პერსონალი❤️ სუფთა ნომერი ❤️ განსაკუთრებით ყურადღებიანი და თბილი დიასახლისები ❤️”
“Nice staff, rich breakfast, clean and tidy space, excellent location”
“The room and bathroom were big enough. Staff and manager were awesome. Convenient location with parking. Great favorites 😍. Breakfast was with great option. The view from the room was beautiful 😍”
“Nice new 4 stae hotel, has a pool, comfortable beds.”
“Everything was great , breakfast is so tasty and hotel staff is very friendly”
“An excellent hotel with kind and wonderful staff. I was really satisfied and highly recommend it to everyone. The breakfast was great, the cleanliness was exceptional, and it is located in a...”
“Location was good. You did not mention that you have a restaurant on the premises which we found very convenient.”
“The WiFi signal in my room was poor. Only one elevator in the building, which made moving in and out, taking a long time. For most of the occasions, I used the stairs.”
“Good room for family, with connecting door. Room is clean.
Staffs are helpful, breakfast is good. Location is good. Food from bar restaurant is good taste.”
“Amazing rooms, lovely staff and peaceful! Felt safe too !”
“ძაალიან სასიამოვნო გარემო , მოწესრიგებული და ყურადღებიანი პერსონალი❤️ სუფთა ნომერი ❤️ განსაკუთრებით ყურადღებიანი და თბილი დიასახლისები ❤️”
“Nice staff, rich breakfast, clean and tidy space, excellent location”
“The room and bathroom were big enough. Staff and manager were awesome. Convenient location with parking. Great favorites 😍. Breakfast was with great option. The view from the room was beautiful 😍”
“Nice new 4 stae hotel, has a pool, comfortable beds.”
“Everything was great , breakfast is so tasty and hotel staff is very friendly”
“An excellent hotel with kind and wonderful staff. I was really satisfied and highly recommend it to everyone. The breakfast was great, the cleanliness was exceptional, and it is located in a fantastic location.”
“Location was good. You did not mention that you have a restaurant on the premises which we found very convenient.”
“The WiFi signal in my room was poor. Only one elevator in the building, which made moving in and out, taking a long time. For most of the occasions, I used the stairs.”
Process finished with exit code 0
но я не уверен, что это комментарии со всех страниц. Как мне извлечь комментарии со всех страниц? что мне следует добавить, чтобы парсить и другие страницы? Заранее спасибо
Моя задача — извлечь комментарии с сайта booking.com, ссылка указана как Отель Тбилиси Тауэр Я хочу извлечь комментарии с разных страниц, а именно если нажать прочитать все отзывы , мы видим, что существует более 300 страниц, и с каждой страницы я могу извлекать комментарии, я написал следующий код: [code]from bs4 import BeautifulSoup import requests url ='https://www.booking.com/hotel/ge/tbilisi-tower-tbilisi.en-gb.html?aid=339738&label=tbilisi-9HByUQ9gPsLl56jk1ktJYAS388385943105%3Apl%3Ata%3Ap11820%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-90146752673%3Alp9198877%3Ali%3Adec%3Adm%3Appccp%3DUmFuZG9tSVYkc2RlIyh9YU5pXiVhsEsYF5VzKbQXpIg&sid=1c94570f144a332c36feeee1d46bcbe0&all_sr_blocks=534523702_210668006_2_1_0&checkin=2024-12-20&checkout=2024-12-21&dest_id=900047975&dest_type=city&dist=0&group_adults=2&group_children=0&hapos=1&highlighted_blocks=534523702_210668006_2_1_0&hpos=1&matching_block_id=534523702_210668006_2_1_0&no_rooms=1&req_adults=2&req_children=0&room1=A%2CA&sb_price_type=total&sr_order=popularity&sr_pri_blocks=534523702_210668006_2_1_0__18176&srepoch=1734279281&srpvid=b491722d29710489&type=total&ucfs=1&#tab-main' content =requests.get(url).text content =BeautifulSoup(content,'html.parser') print(content.find_all("div",class_='a53cbfa6de b5726afd0b')) print("here is full messages :") for message in content.find_all("div",class_='a53cbfa6de b5726afd0b'): print(message.text) [/code] и возвращает следующий результат: [code]“Good room for family, with connecting door. Room is clean. Staffs are helpful, breakfast is good. Location is good. Food from bar restaurant is good taste.” “Amazing rooms, lovely staff and peaceful! Felt safe too !” “ძაალიან სასიამოვნო გარემო , მოწესრიგებული და ყურადღებიანი პერსონალი❤️ სუფთა ნომერი ❤️ განსაკუთრებით ყურადღებიანი და თბილი დიასახლისები ❤️” “Nice staff, rich breakfast, clean and tidy space, excellent location” “The room and bathroom were big enough. Staff and manager were awesome. Convenient location with parking. Great favorites 😍. Breakfast was with great option. The view from the room was beautiful 😍” “Nice new 4 stae hotel, has a pool, comfortable beds.” “Everything was great , breakfast is so tasty and hotel staff is very friendly” “An excellent hotel with kind and wonderful staff. I was really satisfied and highly recommend it to everyone. The breakfast was great, the cleanliness was exceptional, and it is located in a...” “Location was good. You did not mention that you have a restaurant on the premises which we found very convenient.” “The WiFi signal in my room was poor. Only one elevator in the building, which made moving in and out, taking a long time. For most of the occasions, I used the stairs.” “Good room for family, with connecting door. Room is clean. Staffs are helpful, breakfast is good. Location is good. Food from bar restaurant is good taste.” “Amazing rooms, lovely staff and peaceful! Felt safe too !” “ძაალიან სასიამოვნო გარემო , მოწესრიგებული და ყურადღებიანი პერსონალი❤️ სუფთა ნომერი ❤️ განსაკუთრებით ყურადღებიანი და თბილი დიასახლისები ❤️” “Nice staff, rich breakfast, clean and tidy space, excellent location” “The room and bathroom were big enough. Staff and manager were awesome. Convenient location with parking. Great favorites 😍. Breakfast was with great option. The view from the room was beautiful 😍” “Nice new 4 stae hotel, has a pool, comfortable beds.” “Everything was great , breakfast is so tasty and hotel staff is very friendly” “An excellent hotel with kind and wonderful staff. I was really satisfied and highly recommend it to everyone. The breakfast was great, the cleanliness was exceptional, and it is located in a fantastic location.” “Location was good. You did not mention that you have a restaurant on the premises which we found very convenient.” “The WiFi signal in my room was poor. Only one elevator in the building, which made moving in and out, taking a long time. For most of the occasions, I used the stairs.”
Process finished with exit code 0 [/code] но я не уверен, что это комментарии со всех страниц. Как мне извлечь комментарии со всех страниц? что мне следует добавить, чтобы парсить и другие страницы? Заранее спасибо