A proxy server for the Danbooru API that filters posts by tags and provides a paginated API.
Node:
npm i
npm run build
node .Bun:
bun i
bun run src/index.tsThe server will be available at http://localhost:14569.
Get a page of posts filtered by tags.
Query Parameters:
tags: A space-separated list of tags to filter by.page: The page number to retrieve.
Additional Tag Filtering Syntax:
- OR:
tag1 tag2 tag3 tag4 O-> tag1 AND tag2 AND (tag3 OR tag4) - Chained OR:
tag1 tag2 tag3 tag4 O O-> tag1 AND (tag2 OR tag3 OR tag4)
The server can be configured using environment variables.
SERVER_URL: The base URL of the booru server.- Default:
https://danbooru.donmai.us
- Default:
TAG_LIMIT: The maximum number of tags to use for the primary filter.- Default:
2
- Default:
PAGE_LIMIT: The number of posts to fetch from the API per page.- Default:
200
- Default:
LOCAL_PAGE_SIZE: The number of posts to return to the client per page.- Default:
30
- Default:
MAX_EMPTY_CHECK: The maximum number of consecutive empty pages to check before stopping.- Default:
10
- Default:
PORT: The port to run the server on.- Default:
14569
- Default:
LOGS: A 3-digit string to enable/disable logging for different parts of the application.POSTS: The first digit enables/disables logging for post fetching.POSTS_DEBUG: The second digit enables/disables debug logging for post fetching.REDIRECT: The third digit enables/disables logging for redirects.- E.g.:
111enables all logs,101enables logs for post fetching and redirects. - Default:
000(all logs disabled) - ARGUMENT override ENVIRONMENT VARIABLE