Skip to content

lennart-johansson/blocket-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blocket-cli

CI Python 3.10+ License: MIT

Fast CLI for searching Blocket.se — Sweden's largest marketplace.

Search the general marketplace, cars, boats, and motorcycles. Designed for agents, scripts, and quick terminal lookups. Minimal dependencies, structured output.

Install

pip install blocket-cli

Or with uv:

uv tool install blocket-cli

Usage

Search general marketplace

blocket search "soffa"
blocket search "iphone 15" -l stockholm --price-max 8000
blocket search "mountainbike" -c sports --sort price-asc -n 10
blocket search "ps5" -c electronics -o json | jq '.results[:3]'

Search cars

blocket cars "volvo xc60" --year-min 2018 --mileage-max 12000
blocket cars "tesla model 3" --fuel el --sort price-asc
blocket cars "vw alltrack" -l stockholm --price-max 300000 -o json

Search boats

blocket boats "segelbat" --length-min 30
blocket boats "bayliner" --sort price-asc -o json

Search motorcycles

blocket mc "yamaha mt-07" --year-min 2020
blocket mc "harley" --sort price-desc -o json

Get ad details

blocket ad 20851738
blocket ad 20851738 -o json

Browse filters

blocket categories    # general marketplace categories
blocket locations     # Swedish counties
blocket fuels         # fuel types for car search

Output formats

Flag Format Use case
(default) Human-readable table Terminal browsing
-o json Compact JSON Piping to jq, API consumption
-o jsonl One JSON object per line Streaming, log processing

Common options

All search commands support these shared options:

Option Description
-l, --location Filter by Swedish county (e.g. stockholm, skane)
--price-min Minimum price in SEK
--price-max Maximum price in SEK
--sort Sort order (relevance, price-asc, price-desc, date)
-n, --limit Max results to display
-p, --page Page number
-o, --output Output format (table, json, jsonl)
--raw Full API response instead of slim fields

General marketplace options

Option Description
-c, --category Category filter (electronics, furniture, sports, etc.)

Car options

Option Description
--year-min / --year-max Model year range
--mileage-min / --mileage-max Mileage in Swedish mil (1 mil = 10 km)
--fuel Fuel type (bensin, diesel, el, hybrid-bensin, etc.)
--transmission manuell or automat
--sort Also supports mileage-asc, mileage-desc, year-asc, year-desc

Boat options

Option Description
--length-min / --length-max Length in feet

Motorcycle options

Option Description
--year-min / --year-max Model year range
--mileage-min / --mileage-max Mileage in Swedish mil
--sort Also supports mileage-asc, mileage-desc, year-asc, year-desc

Agent integration

The JSON output is designed for LLM agents and automation:

# Compact car search results
blocket cars "volvo" --year-min 2020 -o json | jq '.results[:3]'

# Stream general listings line by line
blocket search "soffa" -o jsonl

# Price analysis
blocket cars "tesla model 3" --fuel el -o json | python3 -c "
import sys, json
data = json.load(sys.stdin)
prices = [r['price'] for r in data['results'] if r.get('price') and r['price'] > 10]
print(f'Found {data[\"total\"]} listings')
print(f'Price range: {min(prices):,} - {max(prices):,} SEK')
print(f'Average: {sum(prices)//len(prices):,} SEK')
"

License

MIT

About

Fast CLI for searching Blocket.se — optimized for agents and scripting

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages