Skip to content
jordiparraPublic

About

Claude Code plugin for selling items on Blocket - automated pricing research, ad generation, and browser automation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Blocket Seller Plugin

A Claude Code plugin for selling items on Blocket, the Swedish online marketplace. Analyzes item photos, researches fair market pricing, generates optimized ad copy in English, and automates listing creation via browser automation.

Features

  • Image Analysis: Upload photos and get automatic item identification (brand, model, condition)
  • Market Research: Automatically searches Tradera for comparable listings and general web for retail pricing
  • Smart Pricing: Provides low/recommended/high price estimates based on Tradera auction data and retail context
  • Ad Generation: Creates compelling, honest ad copy following Blocket best practices
  • Category Matching: Suggests appropriate Blocket categories from the complete category hierarchy
  • Browser Automation: Uses Playwright to fill in and submit the Blocket form automatically
  • Two Modes: Post mode (browser automation) or Copy mode (clipboard only)

Prerequisites

  • Claude Code (latest version)
  • Python 3.8+
  • Playwright (for browser automation)
  • macOS/Linux (uses pbcopy for clipboard operations)

Installation

1. Install the Plugin

Copy the plugin to your Claude Code plugins directory:

cp -r blocket ~/.claude/plugins/

Or use it as a project-specific plugin:

cp -r blocket /path/to/your/project/.claude-plugin/

2. Set Up Python Virtual Environment

The plugin requires Playwright for browser automation:

cd ~/.claude/plugins/blocket
python3 -m venv .venv
.venv/bin/pip install -r scripts/requirements.txt
.venv/bin/playwright install chromium

Note: The virtual environment must be at blocket/.venv/ as the scripts reference this path.

3. First-Time Blocket Login

On first run, the Playwright script will open a browser and prompt you to log in to Blocket:

  • Log in via email + code, or BankID
  • The session will be saved to ~/.blocket-session/ for future use
  • You won't need to log in again unless the session expires

Configuration

Personal Settings (Optional but Recommended)

To save time on repeat listings, create .claude/blocket.local.md in your project directory:

---
# Your Blocket seller profile
postnummer: "12345"
location: "Stockholm"

# Preferences
auto_copy_mode: false
language: "en"

# Optional defaults (leave empty to be asked each time)
default_condition: ""
default_delivery: ""
---

# Blocket User Settings

Your saved preferences for Blocket listings.

Template: Copy from skills/blocket-sell/examples/blocket-settings-template.md

Important: This file is gitignored by default (.claude/*.local.md) and contains your personal data. Do not commit it to version control.

What You Can Configure

  • postnummer: Your Swedish postal code (required for all Blocket ads)
  • location: Your city/neighborhood (improves ad visibility)
  • auto_copy_mode: true to default to copy mode, false to use browser posting
  • language: "en" for English ads, "sv" for Swedish ads
  • default_condition: Pre-fill condition field (e.g., "good", "very good", "like new")
  • default_delivery: Pre-fill delivery options (e.g., "pickup only", "shipping available")

The skill will automatically load these settings and only ask for missing information. After your first listing, the skill will offer to create this file for you.

Usage

Method 1: Using the Skill (Conversational)

Simply describe what you want to sell or provide photos:

"I want to sell this camera" [attach photo]
"Sell my old synthesizer on Blocket" [attach photos]
"List this IKEA bookshelf on Blocket"

The skill will guide you through the complete workflow:

  1. Analyze item photos
  2. Research market pricing
  3. Generate ad copy
  4. Offer refinements
  5. Post to Blocket (or copy to clipboard)

Method 2: Using the /sell Command

For direct access with options:

Default mode (browser automation):

/sell [image path or description]

Copy mode (clipboard only, no browser):

/sell --copy [image path or description]

Examples:

/sell ~/Desktop/camera.jpg
/sell --copy "Fujifilm X-T4 with lens"
/sell

If you don't provide an image or description, the skill will ask you to drag and drop photos.

How It Works

Workflow Overview

  1. Item Identification

    • Analyzes uploaded photos to identify brand, model, condition
    • Extracts visible details like color, size, accessories
    • Asks for information not visible in photos (postnummer, hidden defects)
  2. Market Research

    • Fetches Tradera auction listings for comparable used prices
    • Searches for retail prices from official sources
    • Compiles pricing tiers: low/recommended/high based on market data
  3. Category Selection

    • Matches item against Blocket's category hierarchy
    • Suggests appropriate category path
    • Allows user override if needed
  4. Ad Generation

    • Writes compelling title (max 60 characters)
    • Creates detailed description in English (100-300 words)
    • Includes new retail price for context
    • Adds pickup/shipping logistics
  5. Listing Refinement

    • Presents complete ad for review
    • Allows price, description, or category changes
    • Iterates until user is satisfied
  6. Publishing

    • Post mode: Runs Playwright script to open browser, fill form, pause for review
    • Copy mode: Copies listing text to clipboard, provides Blocket URL

Browser Automation Details

The Playwright script (scripts/post_to_blocket.py):

  1. Opens Chromium with saved session from ~/.blocket-session/
  2. Navigates to Blocket's ad creation form
  3. Selects "Torget" (marketplace) ad type
  4. Fills in category dropdowns based on listing JSON
  5. Populates title, price, description, postnummer
  6. Uploads images
  7. Pauses for user review (does NOT auto-submit)
  8. Keeps browser open for 5 minutes for manual review and publishing

Security: The script never auto-submits. You always review and publish manually.

Important Notes

Check the weight field before publishing:

  • Blocket's form defaults to "5 kg eller mindre" (5kg or less) for most categories
  • The automation script does NOT set the weight field
  • You must manually verify and adjust the weight during the review step
  • This is especially important for heavy items (furniture, appliances, etc.)

File Structure

blocket/
├── .claude-plugin/
│   └── plugin.json              # Plugin manifest
├── .venv/                        # Python virtual environment (created during setup)
├── commands/
│   └── sell.md                   # /sell command definition
├── skills/
│   └── blocket-sell/
│       ├── SKILL.md             # Main skill instructions
│       └── references/
│           ├── ad-writing-guide.md          # Ad copywriting best practices
│           ├── blocket-categories.md        # Complete category hierarchy
│           └── blocket-automation-challenges.md  # Technical notes
├── scripts/
│   ├── post_to_blocket.py       # Playwright automation script
│   └── requirements.txt         # Python dependencies
├── blocket.local.md             # Your personal settings (gitignored)
├── .gitignore                   # Excludes .venv, .local.md, session data
└── README.md                    # This file

Troubleshooting

Browser Automation Issues

"SingletonLock" error:

rm -rf ~/.blocket-session/SingletonLock

Session expired / login required:

  • Delete session data: rm -rf ~/.blocket-session/
  • Run the script again and log in fresh

Form fields not filling correctly:

  • Check that your listing JSON has all required fields
  • Blocket may have changed their form structure; check scripts/post_to_blocket.py selectors
  • Use --copy mode as fallback to paste manually

Virtual Environment Issues

"No module named playwright":

cd ~/.claude/plugins/blocket
.venv/bin/pip install -r scripts/requirements.txt
.venv/bin/playwright install chromium

Wrong Python version:

  • Ensure Python 3.8+ is installed
  • Recreate venv: rm -rf .venv && python3 -m venv .venv

Pricing Research Issues

"Insufficient search results":

  • The skill will still generate a listing, but may not have pricing data
  • Manually research comparable items and override the suggested price
  • Some niche items may not have recent Blocket/Tradera listings

Privacy & Security

What's Stored Locally

  • Browser session: ~/.blocket-session/ contains your Blocket login session (cookies, auth tokens)
  • Personal settings: blocket.local.md contains your postnummer and preferences
  • Temporary files: /tmp/blocket_listing.json contains listing data during posting

What's NOT Included in Git

The .gitignore excludes:

  • .venv/ (Python virtual environment)
  • *.local.md (personal settings)
  • .blocket-session/ (login session)
  • /tmp/ (temporary listing files)

Publishing to GitHub

If you fork this plugin, ensure you:

  1. Do NOT commit blocket.local.md with your personal postnummer
  2. Do NOT commit .blocket-session/ directory
  3. Review .gitignore before pushing

The plugin manifest uses a generic author placeholder. Update it with your own info if publishing.

Advanced Usage

Custom Category Selection

Edit skills/blocket-sell/references/blocket-categories.md to add new categories or adjust the hierarchy as Blocket updates their system.

Ad Writing Customization

Edit skills/blocket-sell/references/ad-writing-guide.md to adjust:

  • Tone and style preferences
  • Description structure
  • Common phrases
  • Condition terminology

Playwright Script Customization

The script at scripts/post_to_blocket.py can be modified to:

  • Change browser viewport size
  • Adjust timeout durations
  • Add additional form field mappings
  • Support different Blocket form variations

Contributing

Contributions welcome! Areas for improvement:

  • Support for additional marketplaces (Facebook Marketplace, Marketplace by Schibsted)
  • Multi-language ad generation (Swedish, Norwegian, Finnish)
  • Automated price tracking and repricing
  • Integration with shipping providers
  • Enhanced image editing and optimization

License

MIT License - See LICENSE file for details

Acknowledgments

Built with:


Need Help? Open an issue or check the troubleshooting section above.

About

Claude Code plugin for selling items on Blocket - automated pricing research, ad generation, and browser automation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages