This project is a sophisticated eBay scraper and market analysis tool. It scrapes product data from eBay, analyzes the market trends using Google's Gemini AI, and generates an interactive dashboard with visualizations using Bokeh.
- Web Scraping: Scrapes eBay search results for product names and prices.
- Proxy Support: Configurable proxy support (Bright Data) with automatic fallback to direct connection.
- AI Market Analysis: Uses Google Gemini 1.5 Flash via LangChain and LangGraph to provide a professional market summary (price ranges, trends, buying advice).
- Interactive Dashboard: Generates a rich HTML dashboard using Bokeh containing:
- Price Distribution Scatter Plot
- Price Frequency Histogram
- Top 5 Cheapest Options Bar Chart
- Quick Statistics (Average, Median, Min, Max)
- Embedded AI Analysis Report
- Task Queue: Built on Celery for asynchronous task execution (can also run in eager mode for local testing).
- Python 3.13+
- Redis (for Celery broker)
- Google Cloud API Key (for Gemini)
-
Clone the repository:
git clone <repository-url> cd ebay-products-market-analizer
-
Install dependencies: It is recommended to use a virtual environment.
pip install -r requirements.txt # Or if using uv/poetry based on pyproject.toml pip install .
Key dependencies:
requests,beautifulsoup4,celery,bokeh,pandas,langchain,langgraph,langchain-google-genai,python-dotenv. -
Configure Environment Variables: Create a
.envfile in theebay-products-market-analizerdirectory (or root) with the following keys:# Google Gemini API Key (Required for AI Analysis) GOOGLE_API_KEY=your_google_api_key_here # Bright Data Proxy Credentials (Optional) BRD_USERNAME=your_username BRD_PASSWORD=your_password
-
Start Redis: Ensure a Redis server is running locally on port 6379.
redis-server
The script is configured to run in "eager mode" by default, meaning it doesn't require a separate Celery worker process to be running. It will execute the scraping and analysis immediately.
-
Navigate to the project directory:
cd ebay-products-market-analizer -
Run the main script:
python main.py
-
Output:
- The script will print the scraping progress and the AI analysis to the console.
- It will save a CSV file:
ebay_product_list_<search_term>.csv. - It will generate and automatically open an HTML dashboard:
ebay_dashboard_<search_term>.html.
To use the actual asynchronous task queue:
-
Modify
ebay-products-market-analizer/main.py: Setapp.conf.task_always_eager = Falsein theif __name__ == "__main__":block. -
Start the Celery worker:
celery -A main worker --loglevel=info
-
Run the script to dispatch the task:
python main.py
ebay-products-market-analizer/main.py: The core script containing the scraper, LangGraph workflow, Gemini integration, and Bokeh visualization logic.pyproject.toml: Project dependencies and configuration.
- Proxy Errors: If the proxy fails, the script automatically falls back to a direct connection. Check your
BRD_USERNAMEandBRD_PASSWORDif you intend to use proxies. - Gemini Errors: Ensure your
GOOGLE_API_KEYis valid and has access to thegemini-1.5-flashmodel. - Bokeh Errors: If the browser doesn't open automatically, look for the generated
.htmlfile in the directory and open it manually.