Skip to content

A powerful Chrome extension that scrapes real-time ride data from Uber's website. This extension is tab-independent and only displays real scraped data - no mock or fallback data.

License

Notifications You must be signed in to change notification settings

asish231/uber-scraper-extension

Repository files navigation

Uber Scraper Chrome Extension

A powerful Chrome extension that scrapes real-time ride data from Uber's website. This extension is tab-independent and only displays real scraped data - no mock or fallback data.

πŸš€ Features

  • βœ… Real-time Scraping: Scrapes actual ride data from Uber's page
  • βœ… Tab Independent: Works regardless of which tab is currently active
  • βœ… No Mock Data: Only shows real scraped data from Uber
  • βœ… Auto-Detection: Automatically detects ride options, prices, and ETAs
  • βœ… Bridge Server: Includes Python FastAPI server for external API access
  • βœ… Beautiful UI: Modern, dark-themed popup interface
  • βœ… Export Options: Copy data as JSON or CSV

πŸ“‹ How It Works

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Uber Website   β”‚ ← Content Script scrapes data
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Background.js  β”‚ ← Manages communication
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ί Popup (displays data)
         β”‚
         └──────────► Bridge Server (WebSocket)
                      └──► External APIs

Components

  1. Content Script (content.js)

    • Injected into Uber pages
    • Scrapes ride options, prices, ETAs, capacity
    • Uses MutationObserver for real-time updates
    • NO fallback or mock data
  2. Background Service Worker (background.js)

    • Manages WebSocket connection to bridge server
    • Handles tab management and script injection
    • Stores scraped data in chrome.storage
    • Routes messages between components
  3. Popup (popup.html/js)

    • Displays scraped data in beautiful UI
    • Shows cheapest and fastest options
    • Export functionality (JSON/CSV)
    • Only renders when real data is available
  4. Bridge Server (bridge_server.py)

    • FastAPI WebSocket server
    • Exposes HTTP endpoints for external access
    • Enables automation and integration

πŸ› οΈ Installation

1. Install the Extension

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable Developer mode (top right)
  3. Click Load unpacked
  4. Select the uber-scraper-extension folder

2. Start the Bridge Server (Optional)

The bridge server enables external API access:

cd uber-scraper-bridge
pip install fastapi uvicorn websockets
python bridge_server.py

Server will start at http://localhost:8765

πŸ“– Usage

Using the Popup

  1. Navigate to Uber: Go to https://m.uber.com/go/product-selection
  2. Enter Locations: Set pickup and dropoff locations on Uber's page
  3. Open Extension: Click the extension icon
  4. Scrape Rides: Click "Scrape Rides" button
  5. View Results: See real-time ride data, prices, and ETAs

Using the API (with Bridge Server)

Scrape Current Page

curl -X POST http://localhost:8765/scrape

Set Locations and Scrape

curl -X POST http://localhost:8765/scrape \
  -H "Content-Type: application/json" \
  -d '{"pickup": "Times Square", "dropoff": "Central Park"}'

Get Last Scraped Data

curl http://localhost:8765/last-data

Get Cheapest Ride

curl http://localhost:8765/cheapest

Get Fastest Ride

curl http://localhost:8765/fastest

πŸ” Data Structure

The extension scrapes and returns the following data:

{
  "success": true,
  "timestamp": "2025-12-15T20:35:12.000Z",
  "pickup": "Times Square, New York",
  "dropoff": "Central Park, New York",
  "totalRides": 5,
  "rides": [
    {
      "productId": "ride-0",
      "name": "UberX",
      "vehicleType": "UberX",
      "imageUrl": "https://...",
      "capacity": 4,
      "price": "β‚Ή250",
      "originalPrice": "β‚Ή300",
      "priceNumeric": 250,
      "eta": "3 min",
      "isSelected": false,
      "scrapedAt": "2025-12-15T20:35:12.000Z"
    }
  ],
  "cheapestRide": { /* ride object */ },
  "fastestRide": { /* ride object */ }
}

⚠️ Important Notes

No Mock Data

This extension ONLY displays real scraped data from Uber's website. If you see an empty state, it means:

  • You haven't scraped yet, OR
  • No ride data is available on the current Uber page

Tab Independence

The extension works independently of which tab is active:

  • It finds or creates an Uber tab automatically
  • Scrapes data from that tab
  • Displays results in the popup

Selectors

The extension uses specific CSS selectors to find ride data. If Uber changes their website structure, the selectors in content.js may need updating.

πŸ› Troubleshooting

"No rides visible"

  • Make sure you're on an Uber page with ride options
  • Ensure pickup and dropoff locations are set
  • Wait for the page to fully load

"Extension not connected"

  • The bridge server is not running (only needed for API access)
  • Extension can still work without the bridge server

"Failed to scrape rides"

  • Check if you're on the correct Uber URL
  • Verify the content script is injected (check console)
  • Uber may have changed their website structure

πŸ”§ Development

File Structure

uber-scraper-extension/
β”œβ”€β”€ manifest.json          # Extension configuration
β”œβ”€β”€ background.js          # Service worker
β”œβ”€β”€ content.js            # Scraping logic
β”œβ”€β”€ popup.html            # Popup UI
β”œβ”€β”€ popup.js              # Popup logic
β”œβ”€β”€ popup.css             # Popup styles
└── icons/                # Extension icons

uber-scraper-bridge/
└── bridge_server.py      # FastAPI WebSocket server

Key Selectors (in content.js)

const SELECTORS = {
  rideItem: '[data-testid="product_selector.list_item"]',
  pickupInput: 'input[placeholder="Pickup location"]',
  dropoffInput: 'input[placeholder="Dropoff location"]',
  resultItem: '[data-testid="pudo-result"]',
  priceText: '.css-jeMYle',
  eta: '[data-testid="product_selector.list_item.eta_string"]',
  vehicleName: 'p[class*="jsRibq"]'
};

πŸ“ License

This is a development tool for educational purposes. Use responsibly and in accordance with Uber's Terms of Service.

🀝 Contributing

This extension is designed to scrape real data only. When contributing:

  • Never add mock or fallback data
  • Maintain tab independence
  • Update selectors if Uber's structure changes
  • Test thoroughly on actual Uber pages

Made with ❀️ for real-time ride data scraping

About

A powerful Chrome extension that scrapes real-time ride data from Uber's website. This extension is tab-independent and only displays real scraped data - no mock or fallback data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published