A powerful and efficient scraper for collecting reviews from Booking.com hotels. This scraper uses Puppeteer and GraphQL to fetch detailed review data including text, scores, dates, and language detection.
- GraphQL Integration: Directly queries Booking.com's GraphQL API for efficient data retrieval
- Language Detection: Automatically detects review language using
francandlangslibraries - Duplicate Prevention: Ensures no duplicate reviews are collected
- Date Range Filtering: Collects reviews within specified date ranges
- Rate Limiting Protection: Implements retry mechanisms and delays to avoid rate limiting
- Comprehensive Data: Collects detailed review information including:
- Review text (positive and negative aspects)
- Review scores
- Dates
- Accommodation types
- Reviewer information
- Hotel responses
- Language detection
{
"startDate": "2024-01-01",
"endDate": "2024-03-20",
"hotels": [
{
"url": "https://www.booking.com/hotel/tr/example.html",
"hotelName": "Example Hotel"
}
]
}{
"review_id": "unique_review_id",
"review_url": null,
"accommodation_type": "FRIEND|FAMILY|COUPLE|SOLO|BUSINESS",
"date": "2024-03-20T00:00:00.000Z",
"hotel_name": "Example Hotel",
"language": "en|tr|fr|de|...",
"review_text": "Review content...",
"response": {
"replied": true|false,
"date": null,
"text": "Hotel response text..."
},
"reviewer": "username",
"score": 9.5,
"source": "Booking"
}apify: ^3.0.0puppeteer: 24.9.0got: ^11.8.0franc: ^6.1.0langs: ^2.0.0
- Clone the repository:
git clone [repository-url]
cd booking-scraper- Install dependencies:
npm install- Create an
INPUT.jsonfile with your desired configuration:
{
"startDate": "2024-01-01",
"endDate": "2024-03-20",
"hotels": [
{
"url": "https://www.booking.com/hotel/tr/example.html",
"hotelName": "Example Hotel"
}
]
}- Run the scraper:
apify run- Uses
francfor initial language detection - Converts 3-letter language codes to 2-letter ISO codes using
langs - Handles short texts and detection errors gracefully
- Normalizes accommodation types (e.g., "GROUP_OF_FRIENDS" → "FRIEND")
- Combines positive and negative review aspects
- Generates unique review IDs using MD5 hashing
- Filters reviews by date range
- Implements retry mechanism for failed requests
- Handles rate limiting with exponential backoff
- Logs errors and warnings for debugging
- Implements delays between requests to avoid rate limiting
- Uses batch processing for large datasets
- Saves data periodically to prevent data loss
- Efficient memory usage with Set for duplicate checking
Feel free to submit issues and enhancement requests!
This project is licensed under the MIT License - see the LICENSE file for details.