MCPcopy Index your code
hub / github.com/AtoraSuunva/booru

github.com/AtoraSuunva/booru @v2.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.9.0 ↗ · + Follow
104 symbols 181 edges 20 files 40 documented · 38% updated 3mo agov2.9.0 · 2026-02-25★ 898 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

booru

A node package to search boorus

Lint and Test npm GitHub Typescript typings

Only non-EoL versions of Node.js are tested and officially supported. EoL versions are unsupported. Other runtimes (like web, Deno, and Bun) aren't officially supported but issues and PRs are accepted for them.

Features

  • Search posts on 15 different boorus (check sites.json)
  • Search tags on 12 different boorus
  • Normalizes all received data into Post objects that are consistent no matter which booru you use
  • Access to the raw data received from the booru as well (transformed from XML to JSON, if applicable)
  • Alias support for boorus (sb for safebooru.org)
  • Promises
  • Types (using Typescript)
  • Choose the amount of images to get
  • Random support for all sites, using order:random on sites that support it and using custom code on those that don't

Installation

Booru is available on npm:

# Pick your favorite package manager
npm add booru
pnpm add booru
yarn add booru

And available on jsr:

# Pick your favorite runtime
pnpm i jsr:@atorasuunva/booru
deno add jsr:@atorasuunva/booru
bunx jsr add @atorasuunva/booru

Usage

import { search, forSite } from 'booru'

const posts = await search('safebooru', ['glaceon'], {
  limit: 3,
})

for (const post of posts) {
  console.log(post.fileUrl, post.postView)
}

// Or, using alias support and creating 

const Booru = require('booru')

Booru.search('safebooru', ['glaceon'], { limit: 3, random: true }).then(
  posts => {
    for (let post of posts) console.log(post.fileUrl, post.postView)
  },
)

// or (using alias support and creating boorus)
const sb = forSite('sb')

const petPosts = await sb.search(['cat', 'dog'], { limit: 2 })

See example.js for more examples


Docs

Available here: https://jsr.io/@atorasuunva/booru/doc

Web support

booru was built for Node.js, and is only officially supported for Node.js. Issues relating to web are fine, although support might be limited.

It's possible to use booru on the web using webpack (or similar), although your experience may vary. Some websites don't have the proper CORS headers, meaning that API requests to those sites from a browser will fail! This is not an issue I can fix in the package, and requires either that booru to add proper support themselves or for you to find a workaround for CORS.

FAQ

What are the properties of a Post?

The basic structure of a Post object looks like:

Post {
  data: {/*...*/},                       // The raw data from the booru
  fileUrl: 'https://aaaa.com/img.jpg',    // The direct link to the image, ready to post
  id: '124125',                           // The image ID, as a string
  tags: ['cat', 'cute'],                  // The tags, split into an Array
  score: 5,                               // The score as a Number
  source: 'https://ex.com/aaa.png',       // Source of the image, if supplied
  rating: 's',                            // Rating of the image
  createdAt: Date,                        // The `Date` this image was created at
  postView: 'https://booru.ex/show/12345' // A URL to the post
}

s: 'Safe' q: 'Questionable' e: 'Explicit' u: 'Unrated'

Derpibooru has Safe, Suggestive, Questionable, Explicit, although Suggestive will be shown as q in <Post>.rating

Can I contribute?

Sure! Just fork this repo, push your changes, and then make a PR.

I'll accept PR based on what they do. Make sure your changes pass the lint (pnpm run lint:fix) and tests (pnpm run test).

Why?

Why not?

License?

It's MIT


Contributors

BobbyWibowo

Change from request-promise-native to snek-fetch

rubikscraft

Add 2 new boorus (furry.booru.org/realbooru.com)
Various Derpibooru fixes

Favna

Add TypeScript declarations
Improve TypeScript port
Various other small fixes

negezor

Add missing type information

iguessthislldo

Copy tags argument so it's not modified

ColonelBologna

> Tag list

Extension points exported contracts — how you extend this code

BooruSearch (Interface)
(no doc)
src/index.ts
ParseBooruResult (Interface)
(no doc)
src/Utils.ts
SiteInfo (Interface)
(no doc)
src/structures/SiteInfo.ts
SearchUrlParams (Interface)
(no doc)
src/boorus/Booru.ts
BooruPostCountOptions (Interface)
(no doc)
src/index.ts
XMLPage (Interface)
(no doc)
src/Utils.ts
SearchParameters (Interface)
(no doc)
src/structures/SearchParameters.ts
TagsURLParams (Interface)
(no doc)
src/boorus/Booru.ts

Core symbols most depended-on inside this repo

resolveSite
called by 8
src/Utils.ts
search
called by 6
src/boorus/Booru.ts
booruFrom
called by 4
src/index.ts
tryParseJSON
called by 4
src/Utils.ts
tagList
called by 4
src/boorus/Booru.ts
querystring
called by 3
src/Utils.ts
parseImageUrl
called by 3
src/structures/Post.ts
normalizeTags
called by 3
src/boorus/Booru.ts

Shape

Method 38
Function 29
Interface 19
Class 18

Languages

TypeScript100%

Modules by API surface

src/Utils.ts19 symbols
src/boorus/Booru.ts18 symbols
src/structures/Post.ts15 symbols
src/index.ts9 symbols
src/structures/SearchResults.ts8 symbols
src/Constants.ts7 symbols
src/structures/TagListResults.ts6 symbols
example.js4 symbols
src/structures/Tag.ts3 symbols
src/structures/Site.ts3 symbols
src/boorus/Derpibooru.ts3 symbols
src/boorus/XmlBooru.ts2 symbols

For agents

$ claude mcp add booru \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page