From 67fe1eeeab298847bf899f1b663e0282d6c5f84d Mon Sep 17 00:00:00 2001 From: kyle10n Date: Wed, 6 Mar 2019 10:31:05 +0100 Subject: [PATCH] It would max at 2 or 3 reviews and stop removing the ::2 index allows the scrapper to find the 5 reviews then go to the next page. If you don't the script thinks it has found all reviews on the first page then stops. --- Web scraping Hilton Hawaiian Village TripAdvisor Reviews.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web scraping Hilton Hawaiian Village TripAdvisor Reviews.py b/Web scraping Hilton Hawaiian Village TripAdvisor Reviews.py index 91f9d01..2656964 100644 --- a/Web scraping Hilton Hawaiian Village TripAdvisor Reviews.py +++ b/Web scraping Hilton Hawaiian Village TripAdvisor Reviews.py @@ -97,7 +97,7 @@ def get_reviews_ids(soup): items = soup.find_all('div', attrs={'data-reviewid': True}) if items: - reviews_ids = [x.attrs['data-reviewid'] for x in items][::2] + reviews_ids = [x.attrs['data-reviewid'] for x in items] print('[get_reviews_ids] data-reviewid:', reviews_ids) return reviews_ids