中文

ACG API

Random Image API - JSON responses & client-side redirects

Quick Start

Get a random image as JSON (truly random, different result each call):

curl https://acg-api.pages.dev/api/random

Get a random image as JSON (static file, same result):

curl https://username.github.io/acg-api/api/random.json

Jump directly to a random image:

https://username.github.io/acg-api/img/random.html

API Endpoints

GET /api/random.json
Return a random image as JSON.
GET /api/{category}.json
Return a random image from a specific category as JSON.
GET /api/categories.json
Return all categories with image counts.
GET /img/random.html
Redirect to a random image in browser.
GET /img/{category}.html
Redirect to a random image from a specific category in browser.

Categories

Loading...

Test

Usage Examples

# Cloudflare Pages - truly random (different result each call)
curl https://acg-api.pages.dev/api/random
curl https://acg-api.pages.dev/api/random?size=5
curl https://acg-api.pages.dev/api/anime
curl https://acg-api.pages.dev/api/categories

# GitHub Pages - static files (same result)
curl https://username.github.io/acg-api/api/random.json
curl https://username.github.io/acg-api/api/anime.json
curl https://username.github.io/acg-api/api/categories.json

# Browser batch requests (requires JavaScript)
https://username.github.io/acg-api/?api=random&size=5
https://username.github.io/acg-api/?api=random&category=anime&size=3

Adding Images

1. Place images in images/category/ directory

2. Push to master branch

3. GitHub Actions auto-updates the index