Skip to content

A simple web application built with NextJS to extract tags from booru websites. Just paste the URL of a booru post, and this tool will fetch and display the associated tags, ready for you to copy.

License

Notifications You must be signed in to change notification settings

IRedDragonICY/booruprompt

Repository files navigation

Booru Tag Extractor

Booru Tag Extractor

Effortlessly extract, categorize, and copy tags from your favorite booru sites

License Next.js React TypeScript Tailwind CSS Framer Motion

Status

πŸš€ Live Demo Β· πŸ“¦ GitHub Repo Β· Report Bug Β· Request Feature


Booru Tag Extractor Screenshot

Tired of manually selecting and copying tags for your AI prompts or image organization? Booru Tag Extractor streamlines the process. Just paste a post URL, and let the tool handle the rest!

✨ Core Features

  • πŸ€– Automatic Extraction: Paste a URL, and tags appear automatically (configurable).
  • 🏷️ Smart Categorization: Tags are automatically sorted into:
  • Copyright Character General Meta Other (Artist, etc.)
  • 🎨 Sleek & Modern UI: Clean interface built with Tailwind CSS and Framer Motion.
  • πŸŒ“ Dark Mode: Comfortable viewing in any lighting condition.
  • πŸ” Intuitive Filtering: Easily toggle categories to customize your tag list.
  • πŸ“‹ Effortless Copy-Paste: Copy the filtered, comma-separated tags with a single click.
  • πŸ“± Responsive Design: Looks and works great on desktop, tablet, and mobile.
  • 🌐 Reliable Fetching: Uses a CORS proxy (AllOrigins) to bypass browser restrictions.

Supported Sites

The extractor currently supports fetching data from the following booru-style sites:

Site Name Status
Danbooru Supported
Safebooru (Donmai) Supported
Safebooru (Org) Supported
Gelbooru Supported
Rule34 Supported
e621 Supported
AIBooru Supported
Yande.re Supported
Konachan Supported
Anime-Pictures.net Supported
Zerochan Supported
E-Shuushuu Supported

🌐 API Usage

This project also exposes server-side API endpoints that act as a proxy to fetch data from booru sites, primarily to overcome CORS limitations in the browser. You can use these endpoints for your own integrations.

Base URL: https://booruprompt.vercel.app/api/fetch-booru

1. Fetch Page HTML (POST)

Fetches the raw HTML content of a given booru post page URL.

  • Endpoint: /api/fetch-booru
  • Method: POST
  • Headers:
    • Content-Type: application/json
  • Body (JSON):
    {
      "targetUrl": "YOUR_BOORU_POST_URL"
    }
    • Replace YOUR_BOORU_POST_URL with the actual URL of the booru post (e.g., https://safebooru.org/index.php?page=post&s=view&id=12345).
  • Success Response (200 OK):
    • Content-Type: application/json
    • Body:
      {
        "html": "<!DOCTYPE html>..." // Raw HTML content of the target page
      }
  • Error Response:
    • JSON object with an error field and an appropriate HTTP status code (e.g., 400, 502, 504).
    • Example (400 Bad Request):
      { "error": "Invalid target URL provided." }
    • Example (502 Bad Gateway):
      { "error": "Failed to fetch page from target site. Status: 404 - Not Found", "status": 404 }
  • Example (curl in PowerShell/Bash):
    # PowerShell requires backticks (`) for line continuation
    # Bash uses backslashes (\)
    
    # PowerShell Example:
    curl -X POST "https://booruprompt.vercel.app/api/fetch-booru" `
         -H "Content-Type: application/json" `
         -d '{"targetUrl": "https://safebooru.org/index.php?page=post&s=list"}'
    
    # Bash Example:
    curl -X POST "https://booruprompt.vercel.app/api/fetch-booru" \
         -H "Content-Type: application/json" \
         -d '{"targetUrl": "https://safebooru.org/index.php?page=post&s=list"}'

2. Fetch Image (GET)

Fetches and proxies an image from a given URL. This is mainly used by the frontend for previews but can be used as a simple image proxy.

  • Endpoint: /api/fetch-booru
  • Method: GET
  • Query Parameter:
    • imageUrl: The URL of the image to fetch. Important: Ensure this URL is properly URL-encoded if it contains special characters like &, ?, etc.
  • Success Response (200 OK):
    • Headers: Includes Content-Type (e.g., image/jpeg) and Cache-Control from the upstream source (or a default).
    • Body: The raw image data.
  • Error Response:
    • Plain text error message with an appropriate HTTP status code (e.g., 400, 502, 504).
  • Example (curl):
    # Fetches the image and saves it as output.jpg
    # Replace YOUR_IMAGE_URL with the actual, URL-encoded image URL
    curl "https://booruprompt.vercel.app/api/fetch-booru?imageUrl=YOUR_IMAGE_URL" -o output.jpg
    
    # Example with a (simplified) URL - real URLs might need encoding
    curl "https://booruprompt.vercel.app/api/fetch-booru?imageUrl=https%3A%2F%2Fsafebooru.org%2Fimages%2F4699%2Ff7b8d9...sample.jpg" -o sample_image.jpg

Notes:

  • The API uses a specific User-Agent: BooruTagExtractor/1.1 (Server-Side Proxy; +http://localhost/).
  • Requests have a timeout of 25 seconds.
  • Please use this API responsibly. It relies on the Vercel Hobby plan infrastructure.

πŸš€ Getting Started

Get the project up and running on your local machine.

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/IRedDragonICY/booruprompt.git
    cd booruprompt
  2. Install dependencies:

    # Using npm
    npm install
    
    # Using yarn
    # yarn install
    
    # Using pnpm
    # pnpm install
  3. Run the development server:

    # Using npm
    npm run dev
    
    # Using yarn
    # yarn dev
    
    # Using pnpm
    # pnpm dev
  4. Open http://localhost:3000 in your browser.

πŸ•ΉοΈ How to Use

  1. Paste URL: Copy a direct link to a post page from a supported booru site (e.g., https://danbooru.donmai.us/posts/123456) and paste it into the input field.
  2. Wait (or Click):
  • If Automatic Extraction is enabled (default), tags and a preview should load shortly after pasting.
  • Otherwise, click the "Extract Manually" button.
  1. Filter (Optional): Use the category toggles below the preview to show/hide specific tag types. The tag count updates dynamically.
  2. Copy: Click the "Copy Tags" button to copy the currently displayed, comma-separated tags to your clipboard.

πŸ’» Tech Stack

  • Next.js: React framework for production.
  • React: Library for building user interfaces.
  • TypeScript: Typed superset of JavaScript.
  • Tailwind CSS: Utility-first CSS framework.
  • Framer Motion: Animation library for React.
  • DOMParser API: Native browser API for parsing HTML fetched via proxy.

πŸ› οΈ Development

This project uses the standard Next.js App Router structure.

Available Scripts

  • dev: Starts the development server (usually on localhost:3000).
  • build: Creates a production-ready build.
  • start: Runs the production build.
  • lint: Lints the codebase using ESLint.

🀝 Contributing

Contributions make the open-source community amazing! Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Please ensure your code adheres to the project's linting rules and includes updates to documentation if necessary.

πŸ“„ License

Distributed under the MIT License. See LICENSE file for more information.

πŸ“¬ Contact

IRedDragonICY - @IRedDragonICY

Project Link: https://github.com/IRedDragonICY/booruprompt

File bugs or suggest features via GitHub Issues.

πŸ™ Acknowledgements

  • The teams behind the amazing Booru websites.
  • AllOrigins for the reliable CORS proxy service.
  • Vercel for seamless hosting.
  • All the open-source libraries and tools that made this project possible.

Made with β™₯ by IRedDragonICY

About

A simple web application built with NextJS to extract tags from booru websites. Just paste the URL of a booru post, and this tool will fetch and display the associated tags, ready for you to copy.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published