Skip to content

ShadowOxygen/offerup_scraper

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OfferUp Web Scraper

A full-stack web application for extracting listing data from OfferUp item pages. Built with Python Flask backend and React frontend.

OfferUp Scraper Demo Python React Flask

🌟 Features

  • πŸ” Real-time scraping - Extract data from OfferUp listings instantly
  • 🎨 Modern UI - Beautiful, responsive interface built with React and Tailwind CSS
  • πŸ“Š Complete data extraction - Title, price, description, images, location, and seller info
  • πŸ›‘οΈ Error handling - Robust error handling and retry logic
  • πŸš€ REST API - Clean Flask API with JSON responses
  • ⚑ Fast & efficient - Optimized JSON parsing from embedded data

πŸ“Έ Screenshots

Main Interface

Beautiful gradient UI with input field and real-time results display

Results Display

  • High-quality images
  • Formatted pricing and location
  • Full description with preserved formatting
  • Seller information

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         HTTP           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 β”‚  ──────────────────►   β”‚                 β”‚
β”‚  React Frontend β”‚      (REST API)        β”‚  Flask Backend  β”‚
β”‚  (Port 5173)    β”‚  ◄──────────────────   β”‚  (Port 5000)    β”‚
β”‚                 β”‚       JSON data        β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                    β”‚
                                                    β”‚ imports
                                                    β–Ό
                                           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                           β”‚  scraper.py     β”‚
                                           β”‚  (Core Logic)   β”‚
                                           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Python 3.7 or higher
  • Node.js 16 or higher
  • npm or yarn

Installation

  1. Clone the repository
git clone https://github.com/yourusername/offerup-scraper.git
cd offerup-scraper
  1. Set up the backend
cd backend

# Create virtual environment (optional but recommended)
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
  1. Set up the frontend
cd ../frontend

# Install dependencies
npm install

Running the Application

You'll need two terminal windows:

Terminal 1 - Start the Flask backend:

cd backend
source venv/bin/activate  # If using virtual environment
python api.py

Backend will run on http://127.0.0.1:5000

Terminal 2 - Start the React frontend:

cd frontend
npm run dev

Frontend will run on http://localhost:5173

Open your browser to http://localhost:5173 and start scraping!!!

πŸ“– Usage

Web Interface

  1. Open http://localhost:5173 in your browser
  2. Paste an OfferUp listing URL (e.g., https://offerup.com/item/detail/...)
  3. Click "Scrape"
  4. View the extracted data including images, description, and pricing

API Endpoints

The Flask backend provides these REST API endpoints:

Health Check

GET http://127.0.0.1:5000/api/health

Test Scrape (uses sample listing)

GET http://127.0.0.1:5000/api/test

Scrape Listing

POST http://127.0.0.1:5000/api/scrape
Content-Type: application/json

{
  "url": "https://offerup.com/item/detail/YOUR-LISTING-ID",
  "download_image": false
}

Example with curl:

curl -X POST http://127.0.0.1:5000/api/scrape \
  -H "Content-Type: application/json" \
  -d '{"url":"https://offerup.com/item/detail/4bc65998-e110-3dc8-b0d9-89bbbafd8994"}' \
  | python3 -m json.tool

Command Line Interface (CLI)

You can also use the scraper from the command line:

cd backend

# Basic usage (JSON output)
python scraper.py "https://offerup.com/item/detail/YOUR-LISTING-ID"

# Human-readable text output
python scraper.py "https://offerup.com/item/detail/YOUR-LISTING-ID" -o text

# Download image
python scraper.py "https://offerup.com/item/detail/YOUR-LISTING-ID" -d

# CSV format
python scraper.py "https://offerup.com/item/detail/YOUR-LISTING-ID" -o csv

# Verbose mode (show scraping progress)
python scraper.py "https://offerup.com/item/detail/YOUR-LISTING-ID" -v

# Save to file
python scraper.py "https://offeup.com/item/detail/YOUR-LISTING-ID" > output.json

All CLI options:

python scraper.py --help

πŸ› οΈ Technology Stack

Backend

  • Python 3.7+ - Core language
  • Flask - Web framework
  • BeautifulSoup4 - HTML parsing
  • Requests - HTTP client
  • Flask-CORS - Cross-origin resource sharing

Frontend

  • React 18 - UI library
  • Vite - Build tool and dev server
  • Tailwind CSS - Utility-first CSS framework
  • JavaScript ES6+ - Modern JavaScript

πŸ“ Project Structure

offerup-scraper/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ api.py              # Flask REST API
β”‚   β”œβ”€β”€ scraper.py          # Core scraping logic + CLI
β”‚   β”œβ”€β”€ config.py           # Configuration settings
β”‚   β”œβ”€β”€ utils.py            # Helper functions
β”‚   └── requirements.txt    # Python dependencies
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.jsx         # Main React component
β”‚   β”‚   β”œβ”€β”€ main.jsx        # React entry point
β”‚   β”‚   └── index.css       # Tailwind CSS imports
β”‚   β”œβ”€β”€ public/             # Static assets
β”‚   β”œβ”€β”€ index.html          # HTML template
β”‚   β”œβ”€β”€ package.json        # Node dependencies
β”‚   β”œβ”€β”€ vite.config.js      # Vite configuration
β”‚   └── tailwind.config.js  # Tailwind configuration
β”‚
β”œβ”€β”€ .gitignore              # Git ignore rules
└── README.md               # This file

πŸ”’ Legal & Ethical Considerations

  • βœ… This scraper only accesses individual item pages allowed per OfferUp's robots.txt
  • βœ… Implements rate limiting to avoid server overload
  • βœ… Respects OfferUp's Terms of Service

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ™ Acknowledgments

  • Built as an educational project to learn full-stack development
  • Thanks to the React, Flask, and Tailwind CSS communities

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 70.0%
  • JavaScript 28.7%
  • Other 1.3%