Dataset Viewer

The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.

Metadata of all posts from Danbooru.

I did not include the media_asset field because it is largely redundant with other fields.

Compared to the metadata available at https://huggingface.co/datasets/nyanko7/danbooru2023, the data here was collected at a later time. This means that many fields may differ, such as score. Some tags and author aliases are also more complete.

Typically, the database becomes the bottleneck. On my PC, We can download all metadata in about 3 hours. A better SSD may speed up the process.

Scope

This repository archives Danbooru into SQLite and nothing else: posts, wiki pages, tags, aliases, implications, artists. It is the upstream every other project reads from.

The popularity index built on top of that archive 窶・the Parquet fact tables, the name maps, the binary bundle and the web client 窶・lives in danbooru-tag-index. It opens this database read-only and never writes to it.

Layout

  • scripts/_danbooru.py: shared API client 窶・one account-wide rate limiter, Retry-After-aware backoff, and a fetch that raises rather than returning an empty page.
  • scripts/_env.py: credential resolution (CLI > exported environment > .env).
  • scripts/update_danbooru.py: incremental/full metadata sync from the Danbooru API into SQLite.
  • scripts/update_wiki.py: full archive of Danbooru wiki pages and tag metadata (tags/aliases/implications) into SQLite.
  • scripts/tag_frequency.py: count tag frequency per category (general/artist/character/copyright) into CSV.
  • scripts/_scan.py, scripts/update-danbooru-series.py: bar-chart-race CSVs of cumulative posts per copyright series. Tracked so they are not lost, but they do not run from here as-is: both resolve REPO to this repository and then write into apps/playground/public/, which belongs to a separate monorepo, and _scan.py reads a WSL path. _scan.py supersedes the other.
  • data/db/: SQLite databases.
  • data/outputs/tags/: tag frequency CSV outputs.

Credentials

Copy .env.example to .env and fill in DANBOORU_LOGIN / DANBOORU_API_KEY (generate one at https://danbooru.donmai.us/profile 竊・API Key 竊・Add). .env is gitignored. Both sync scripts read it and print which path they took on their first line; leave it empty to sync anonymously, which works but is rate-limited far harder. --api_key / --login still override it, but don't use them from a scheduled task 窶・command-line arguments land in the task definition, the process list, and shell history.

Rate limiting

Danbooru documents a 10 req/s ceiling. Both sync scripts share one account-wide limiter (--rate, default 5 req/s) rather than throttling per thread 窶・the quota is per account, so sixteen independently-throttled workers overshoot sixteenfold. A 429 halves the shared rate and pauses every worker for Retry-After; sustained success walks it back up. Each run prints the rate it converged on, which is a good --rate for the next one.

Never run two of these against the same SQLite file at once. SQLite locks the whole database, and the index scan in danbooru-tag-index holds a long read transaction 窶・a waiting writer takes a PENDING lock and starves it. The weekly driver serialises them for this reason.

Example:

uv run python scripts/update_danbooru.py     # posts
uv run python scripts/update_wiki.py         # wiki, tags, aliases, implications, artists
uv run python scripts/tag_frequency.py
Downloads last month
76