Skip to content

Repository files navigation

AI Web Scraper 🕷️

A powerful and user-friendly web scraping tool built with Streamlit, Selenium, and Google Gemini AI. This application allows you to scrape content from any website and extract specific information using natural language descriptions.

🚀 Features

  • Web Scraping: Uses Selenium to render and scrape dynamic web content.
  • AI Parsing: Leverages Google's Gemini 1.5 Flash model to intelligently extract data based on your instructions.
  • Clean UI: A modern, dark-themed interface built with Streamlit.
  • DOM View: Inspect the raw and cleaned DOM content before parsing.
  • Robust Handling: Handles various response formats and ensures reliable data extraction.

🛠️ Prerequisites

Before running the application, ensure you have the following installed:

📦 Installation

  1. Clone the repository (if applicable) or navigate to the project directory.

  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up Environment Variables:

    • Create a .env file in the root directory.
    • Add your Google Gemini API key:
      GOOGLE_API_KEY=your_api_key_here
    • You can get an API key from Google AI Studio.

🏃‍♂️ Usage

  1. Start the application:

    streamlit run main.py
  2. Scrape a Website:

    • Enter the URL in the input field.
    • Click "Scrape Website".
  3. Parse Content:

    • Once scraped, expand "View DOM Content" to see what was captured.
    • In the "Parse Content" section, describe what you want to extract (e.g., "Extract all product names and prices").
    • Click "Parse Content" to let Gemini do the magic.

📂 Project Structure

  • main.py: The main Streamlit application and UI logic.
  • scrape.py: Handles Selenium web scraping and content cleaning.
  • parse.py: Interfaces with Google Gemini for content parsing.
  • requirements.txt: List of Python dependencies.
  • .env: Configuration file for API keys (not committed).

⚠️ Note

  • Ensure chromedriver.exe is in the root folder or updated in scrape.py path.
  • The application uses gemini-flash-latest for fast and efficient parsing.

About

AI-powered web scraper using Selenium and Google Gemini to extract structured data from any website via natural language prompts

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages