Skip to content
OPQAI.
Sourced advanced / 💻 Coding

Automate Book Metadata and Cover Fetching with Claude Code

Job to be done: Automate book metadata extraction and cover fetching for a personal library

🇳🇬 Ways to use this in Nigeria

Ideas to get you started, adapt to your situation.

  • Student

    As a university student, digitize your personal collection of textbooks and academic journals, extracting titles and authors from cover photos to build a searchable database for assignments and research.

  • Entrepreneur

    As an entrepreneur running an online book club, automate the creation of a digital catalog for your personal collection of reviewed books, fetching covers and metadata to enrich your website content.

  • 9-5 employee

    As an employee managing a small departmental reference library, digitize its physical book catalog by extracting titles, authors, and covers, creating a searchable JSON for colleagues to quickly find resources.

What you’ll get

A tidy digital catalog of your physical books: a structured data file listing each book’s title, author, and publisher, plus a folder of high-quality cover images. The AI does the boring bulk work (reading hundreds of covers and fetching images), and you step in to fix the small percentage it gets wrong. This is an advanced workflow: you will run Python scripts and use several paid services, so some technical comfort and a budget are needed.

Tools you need

  • Claude Code (paid): an AI coding assistant that writes and runs the Python scripts for you. Needs a paid Claude plan or credits.
  • OpenAI Vision API (paid): an AI service that “reads” text off your cover photos. (“API” means a service your script talks to over the internet; you pay per use.)
  • Open Library API (free): a free book database, used to fetch covers and extra details.
  • SerpAPI (paid): a paid search service, used as a backup to find covers Open Library misses.
  • Photoshop (paid): for hand-fixing the few covers nothing finds. The free tool GIMP works just as well.

Steps

  1. Photograph and prepare your books: take a clear, well-lit photo of every book’s cover or spine and move them to a folder on your computer. If your phone saves photos as HEIC (Apple’s format), convert them to JPG first (any free online converter does this). You should end up with one folder of JPG images.

  2. Open Claude Code: go to code.claude.com and sign in (you need an active plan or credits). You should see a chat-like coding environment where Claude can write and run code.

  3. Ask Claude to write the metadata script: paste this prompt:

    Write a Python script that does the following:
    1. Takes a directory of book cover images (JPG format).
    2. For each image, sends it to OpenAI's Vision API to extract the author, title, and publisher.
    3. Normalizes names (e.g., removes extra spaces, standardizes casing).
    4. Resizes images before sending to the API to save tokens (e.g., max 1024 pixels on the longest side).
    5. Writes the extracted metadata (id, title, author, publisher, source image filename) to a JSON file.
    6. Include robust error handling for API calls and image processing.
    7. Ensure the script can be easily run from the command line, taking the image directory and output JSON file path as arguments.

    Claude returns a Python script plus instructions for setting your OpenAI key. (A “JSON file” is just a structured text file of data; an “API key” is a secret password that proves the request is yours and bills you.)

  4. Run the metadata script: follow Claude’s instructions to run it, supplying your OpenAI API key (store it as an environment variable, a setting on your computer, rather than pasting it into the file) and your image folder. You should get a JSON file with an entry per book, like:

    {
        "id": "ZfEPBCMZDaCKm6k0NVJ8F",
        "title": "Simulacre si simulare",
        "author": "Jean Baudrillard",
        "publisher": "Colectia Panopticon",
        "source": "/dataset/83.jpg"
    }
  5. Review and fix the metadata: open the JSON in any text editor and skim it. The author found roughly 90 percent accuracy, so expect a few wrong titles or authors (a novel labelled as a manual, say). Correct those entries by hand. Aim for “mostly right”, not perfect.

  6. Ask Claude for the cover-fetching script: paste this prompt:

    Write a Python script that does the following:
    1. Reads the book metadata from the JSON file generated in the previous step.
    2. For each book, attempts to fetch a high-quality cover image using the Open Library API, prioritizing good resolution.
    3. If the Open Library API provides a low-quality or incorrect cover, or no cover is found, use SerpAPI to search Google Images for a better cover based on the book's title and author.
    4. Implement a simple scoring mechanism to evaluate cover quality (e.g., resolution, relevance) and flag potentially bad matches.
    5. Save the best found cover image for each book to a designated output folder, named clearly (e.g., by book ID or title).
    6. Ensure the script can be easily run from the command line, taking the metadata JSON file and output image directory as arguments.
  7. Run the cover-fetching script: follow Claude’s instructions, supplying your SerpAPI key and the metadata file. You should get a folder of cover images, with a handful missing or low quality.

  8. Hand-fix the leftover covers: for the few that failed, find the right cover online and drop it into the folder, touching it up in Photoshop or free GIMP if needed. The author fixed about 10 covers out of 460, a small, manageable job.

Original source

Based on balajmarius’s project “Vibe coding a bookshelf with Claude Code”, shared on Hacker News, documenting how they automated cataloging a large personal library with AI and stepped in only for the parts AI got wrong.

Notes & variations

  • Free-tier alternatives: GIMP replaces Photoshop for free. For tiny batches you could try a free vision model (like Gemini in Google AI Studio) to read covers, though you lose Claude Code’s integrated run-the-script convenience.
  • Common mistake: chasing 100 percent accuracy. The author accepted 90 percent from the AI and fixed the rest by hand, because automating the last few oddballs costs more effort than it saves.
  • Tip for better results: test on 10 to 20 books first to refine the prompts and confirm your API keys work, before unleashing it on the whole shelf and spending credits.

Keep going

More Coding workflows