- Fix: title extraction now reads h2 text directly (h2 has no child <a>) - Fix: link extraction uses a.sf-search-ad-link overlay (was falling through to carousel) - Fix: skip skeleton/placeholder articles - Add: --verdict flag with buy_used/buy_new/wait/decent_deal recommendation - Add: verdict compares median used price vs lowest new price with savings % - Add: verdict works standalone (no --compare needed) - Rewrite: README + USAGE docs for the 'go-to' workflow - Refactor: shared _parse_dba_article() for requests + selenium paths
2.6 KiB
2.6 KiB
Usage
The go-to command
python3 dba_pricerunner_scraper.py "YOUR SEARCH" --pricerunner --compare --verdict
This fetches DBA (used) + PriceRunner (new) results, prints a comparison table, and gives you a verdict:
- ✅ BUY USED — used is 20%+ cheaper
- 🤔 DECENT DEAL — used is 5–20% cheaper
- 🏷️ BUY NEW — used barely saves anything
- ⏳ WAIT — used is at or above new price
All options
| Flag | Default | Description |
|---|---|---|
query |
(required) | Search terms (quote multi-word) |
--engine |
requests |
requests or selenium |
--max |
15 |
Max results to fetch |
--top N |
— | Show top N results |
--pricerunner |
off | Also fetch PriceRunner prices |
--compare |
off | Show side-by-side comparison |
--verdict |
off | Add buy/wait recommendation |
--format |
text |
text, markdown, or grid |
--min-price |
— | Filter: exclude items below this price |
--max-price |
— | Filter: exclude items above this price |
--json |
off | Output raw JSON instead of tables |
Examples
# Quick verdict (no table)
python3 dba_pricerunner_scraper.py "iphone 15" --pricerunner --verdict
# Full comparison, markdown format
python3 dba_pricerunner_scraper.py "samsung galaxy s24" --pricerunner --compare --verdict --format markdown
# Filter out cheap accessories
python3 dba_pricerunner_scraper.py "playstation 5 konsol" --pricerunner --compare --verdict --min-price 2000
# ASCII grid for terminal
python3 dba_pricerunner_scraper.py "xbox series x konsol" --pricerunner --compare --verdict --format grid
# Top 5 DBA only (no PriceRunner)
python3 dba_pricerunner_scraper.py "playstation 5" --top 5
# JSON output for scripting
python3 dba_pricerunner_scraper.py "iphone 15" --json
Tips
- Be specific with search terms. "playstation 5 konsol" gives much better results than "playstation 5" (which picks up games, controllers, and cases).
- Use
--min-priceto filter accessories. E.g.--min-price 1000for phones,--min-price 2000for consoles. - The verdict uses the median used price, not the cheapest. This avoids outliers (e.g. one broken console at 500 kr dragging the median down).
- PriceRunner picks the lowest new price across all sellers. This is your "best case" new price.
Selenium engine
If DBA starts blocking requests, try:
pip install selenium webdriver-manager
python3 dba_pricerunner_scraper.py "playstation 5" --engine selenium --pricerunner --compare --verdict
This renders the page in a headless Chrome browser. You need Chrome installed on the system.