Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 2.01 KB

File metadata and controls

39 lines (29 loc) · 2.01 KB

Bright Data Hotel Search Scraper with Playwright

This project demonstrates how to use Bright Data's Scraping Browser with Playwright to search for hotels on Booking.com. It provides a practical example of web scraping with automated browser control using Playwright.

Open in CodeSandbox, sign in with GitHub account, then fork the repository to begin making changes.

Getting Started

  1. Replace YOUR_BRIGHT_DATA_SCRAPING_BROWSER_ENDPOINT with your actual Bright Data scraping browser webSocket endpoint in booking-hotel-scraping.js
  2. Run node booking-hotel-scraping.js to start scraping

💻 Usage

  1. Modify search parameters in booking-hotel-scraping.js:

    const SEARCH_LOCATION = "New York";  // Change to your desired location
    const CHECK_IN_DAYS_FROM_NOW = 1;    // Adjust check-in date
    const CHECK_OUT_DAYS_FROM_NOW = 2;   // Adjust check-out date
  2. Run the script:

    node booking-hotel-scraping.js

📊 Example Output

📊 Search Results:
==================
┌─────────┬─────┬────────────────────┬──────────┬─────────┐
│ (index) │  #  │     Hotel Name     │  Price   │ Rating  │
├─────────┼─────┼────────────────────┼──────────┼─────────┤
│    0    │  1  │ Hotel Name 1       │ $100     │ 8.5     │
│    1    │  2  │ Hotel Name 2       │ $150     │ 9.0     │
│    2    │  3  │ Hotel Name 3       │ $200     │ 8.8     │
└─────────┴─────┴────────────────────┴──────────┴─────────┘