纯静态站点(Cloudflare Pages)。 所有接口都是 GET,JSON 接口已开启 CORS,可被任意网页 / 脚本调用。
GET
/memes.json
(旧版兼容:/api/v1/memes,内部 _redirects 映射为同一份 JSON)
返回所有分类及文件相对路径;前端与脚本可用其拼接直链。
curl -sS ""
{
"generatedAt": "2026-05-19T13:01:45.229Z",
"categories": [
{
"id": "白色小人",
"name": "白色小人",
"items": [
{ "file": "1.webp", "path": "白色小人/1.webp" },
{ "file": "2.webp", "path": "白色小人/2.webp" }
]
}
]
}
.webp / .gif{分类}/{文件名},拼接成 /meme/{path} 即直链站点根目录对应构建产物 dist/(本地从 public/ 同步而来);表情文件在 /meme/<分类>/,对应 URL:
GET
/meme/<分类>/<文件名>.webp
或
.gif
https://meme.smyhub.com/meme/%E7%99%BD%E8%89%B2%E5%B0%8F%E4%BA%BA/1.webp
中文或多段路径请使用编码后的 URL(浏览器会自动处理;图库「复制链接」按钮已帮你编好)。
由 Cloudflare 边缘缓存,Cache-Control: public, max-age=...;按需可直接 ?v=<时间戳> 绕过缓存。
对 /memes.json 与 /api/v1/memes 已配置:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, HEAD, OPTIONS
Access-Control-Allow-Headers: Content-Type
图片资源 /meme/... 无 CORS 限制(普通 <img> / <a> 引用即可)。
原图/<分类>/ 放入未编号素材;运行 python 转化.py,在 原图-已处理/ 生成编号 .webp / .gif 并限最长边(默认 250px)。默认保留 原图/ 源文件,清理可加 --delete-sources。python 转化.py 转换流程中转为 GIF。npm run build:生成 dist/(含 dist/memes.json)。请先把 原图-已处理/ 拷入 public/meme/ 再构建;构建脚本不会覆盖 public/meme/。npm run build → git add/commit/push;仪表盘「构建命令」填 npm run build,「构建输出目录」填 dist。wrangler pages deploy dist 在 Git 项目里常显示为预览,属正常。// 拉清单
const r = await fetch("https://meme.smyhub.com/memes.json");
const { categories } = await r.json();
// 随机抽一张
const cat = categories[Math.floor(Math.random() * categories.length)];
const it = cat.items[Math.floor(Math.random() * cat.items.length)];
const url = `https://meme.smyhub.com/meme/${encodeURIComponent(cat.id)}/${encodeURIComponent(it.file)}`;
console.log(url);
import json, random, urllib.parse, urllib.request
with urllib.request.urlopen("https://meme.smyhub.com/memes.json") as r:
data = json.load(r)
cat = random.choice(data["categories"])
it = random.choice(cat["items"])
url = f"https://meme.smyhub.com/meme/{urllib.parse.quote(cat['id'])}/{urllib.parse.quote(it['file'])}"
print(url)

<img src="https://meme.smyhub.com/meme/%E7%99%BD%E8%89%B2%E5%B0%8F%E4%BA%BA/1.webp"
alt="哈哈" loading="lazy" width="240"
style="max-width:240px;width:100%;height:auto" />