Flask app that scrapes completed (sold) listings for a keyword and shows the last 5 sold prices and their average.
Team Members: Kevin Lin
Goal
- Help Price Items on Ebay using Recently Sold Listings
How to Start:
Using the eBay Finding API (recommended)
- Register at https://developer.ebay.com/ and create an App to obtain an
App ID(also calledClient IDin some places). - Export your App ID into the environment before running the app (PowerShell):
setx EBAY_APP_ID "your-app-id-here"
# or for the current session only:
$env:EBAY_APP_ID = "your-app-id-here"When EBAY_APP_ID is present, the app will use the eBay Finding API's
findCompletedItems operation to fetch completed/sold listings. This avoids
being blocked by anti-bot pages and returns structured JSON.
-
Create a Python 3.9+ virtual environment and activate it.
Windows PowerShell:
python -m venv .venv; .\.venv\Scripts\Activate.ps1 -
Install dependencies:
pip install -r requirements.txt -
Run the app:
python App.py
-
Open
http://127.0.0.1:5000in your browser, enter a keyword, and click "Search". The page will show the last 5 sold prices and their average.
Result Example:
curl "http://127.0.0.1:5000/api/average?keyword=iphone%20case"Example JSON response:
{
"keyword": "iphone case",
"items": [ {"title":"...","price":12.34,"url":"..."} ],
"avg": 12.34,
"source": "api",
"error": null
}Evolution of Project
Orginally, I was on a good track without the use of Ebay ID, but I realized that it wouldn't work unless I had one because it's blocked most likely. I tried fixing it, but as the project evolved I had to lean more on AI. Now, it works with the use of Ebay ID through their developer program, but not without it. In the future, I'd like to make this more accessible if I can.
Attribution
- ChatGPT: Helped with the HTML webscrappin and more complex things
- Co-pilot: Used for research and how to understand & phrase the code
- Tutor and Friends
