Files
newolddkprice/README.md
Alex 243bc9b6f5
Some checks are pending
Python application / build (push) Waiting to run
Add --from flag: travel distance from your location
- Geocodes listing locations via Photon (Komoot) API - no rate limits
- Shows distance in km next to location in all output formats
- Uses geodesic distance (geopy) for accurate km calculation
- Caches geocoded locations to avoid repeated API calls
- Works with --top, --compare, --verdict, and default output
- Example: --from "Farum" shows 'København V (20 km)', 'Korsør (94 km)'
- Added geopy to requirements.txt
2026-08-28 16:04:11 +02:00

93 lines
3.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# newolddkprice
**"Should I buy it used?"** — DBA vs PriceRunner price comparator with verdicts.
Searches [DBA](https://www.dba.dk) for used listings and [PriceRunner](https://www.pricerunner.dk) for new prices, then gives you a side-by-side comparison with a **buy / wait / buy-new** recommendation.
## Quick start
```bash
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# The go-to command:
python3 dba_pricerunner_scraper.py "playstation 5 konsol" --pricerunner --compare --verdict
```
Output:
```
==================================================
SHOULD I BUY IT USED? — playstation 5 konsol
==================================================
🤔 DECENT DEAL
Used is only 12% cheaper (~3,500 kr vs 3,995 kr new).
Decent savings but you lose warranty & returns.
savings: [███░░░░░░░░░░░░░░░░░░░░░░░░░░░] 12%
new: 3,995 kr used median: 3,500 kr range: 1984,500 kr
==================================================
```
## Verdicts
| Verdict | When | Meaning |
|---------|------|---------|
| ✅ **BUY USED** | ≥20% savings | Great deal, buy used |
| 🤔 **DECENT DEAL** | 520% savings | Some savings, but you lose warranty |
| 🏷️ **BUY NEW** | <5% savings | Barely any savings new is worth the premium |
| **WAIT** | Used new | Something's off, wait for better deals |
## Options
| Flag | Description |
|------|-------------|
| `--pricerunner` | Also fetch PriceRunner (new) prices |
| `--compare` | Show side-by-side comparison table |
| `--verdict` | Add the "should I buy it used?" recommendation |
| `--format` | `text` (default), `markdown`, or `grid` |
| `--top N` | Show top N results |
| `--min-price` / `--max-price` | Filter by price (e.g. `--min-price 2000`) |
| `--from` | Your location for distance calculation (e.g. `--from Farum`) |
| `--json` | Output raw JSON |
| `--engine selenium` | Use Selenium instead of requests (for JS-heavy pages) |
## Examples
```bash
# Quick check: is it worth buying used?
python3 dba_pricerunner_scraper.py "iphone 15" --pricerunner --verdict
# Full comparison with markdown table (great for pasting into docs)
python3 dba_pricerunner_scraper.py "samsung galaxy s24" --pricerunner --compare --verdict --format markdown
# Filter out accessories: only look at items 20005000 kr
python3 dba_pricerunner_scraper.py "playstation 5 konsol" --pricerunner --compare --verdict --min-price 2000 --max-price 5000
# Show distances from your location (e.g. Farum)
python3 dba_pricerunner_scraper.py "iphone 15" --from "Farum" --pricerunner --compare --verdict
# ASCII grid for terminal
python3 dba_pricerunner_scraper.py "xbox series x konsol" --pricerunner --compare --verdict --format grid
# Just top 5 DBA listings (no PriceRunner)
python3 dba_pricerunner_scraper.py "playstation 5" --top 5
```
## How it works
1. **DBA** scrapes search results via `requests` (or Selenium). Extracts title, price, location, and URL from each `<article>` card.
2. **PriceRunner** extracts embedded product JSON from the search results page. Gets the lowest new price for each product.
3. **Verdict** compares the **median used price** (DBA) against the **lowest new price** (PriceRunner) and computes savings %.
> **Tip:** Use specific search terms (e.g. "playstation 5 konsol" not "playstation 5") to avoid accessories and games polluting the comparison.
## Requirements
- Python 3.10+
- `requests`, `beautifulsoup4`, `lxml` (see `requirements.txt`)
- Optional: `selenium` + `webdriver-manager` for the `--engine selenium` path
## License
MIT do whatever you want with it.