Install
openclaw skills install joke-apiAccess diverse jokes by category, language, and type with filters for safe content using the free JokeAPI without requiring registration or an API key.
openclaw skills install joke-api获取各种类型的幽默笑话,支持分类、语言、格式过滤。
使用 JokeAPI 免费获取笑话,无需注册或 API 密钥。支持多种分类、语言和响应格式。
joke random
joke random --category Programming
joke random --category Misc,Pun
joke random --type single # 单句笑话
joke random --type twopart # 双部分笑话 (setup + delivery)
joke random --safe-mode # 仅获取安全内容
joke random --blacklist nsfw,explicit # 过滤特定类型内容
joke random --lang en # 英语笑话
joke random --lang de # 德语笑话
joke random --amount 5
joke random --contains "programmer"
https://v2.jokeapi.devGET /joke/{categories}GET /infoGET /categoriesGET /languagesAny - 随机分类Misc - 杂项Programming - 编程Dark - 黑暗幽默Pun - 双关语Spooky - 恐怖Christmas - 圣诞nsfw - 不适宜工作场所religious - 宗教political - 政治racist - 种族主义sexist - 性别歧视explicit - 露骨内容json (默认)xmlyamltxt (纯文本)const baseURL = "https://v2.jokeapi.dev";
const categories = ["Programming", "Misc"];
const params = [
"blacklistFlags=nsfw,religious,racist",
"type=single"
];
fetch(`${baseURL}/joke/${categories.join(",")}?${params.join("&")}`)
.then(res => res.json())
.then(joke => {
if(joke.type == "single") {
console.log(joke.joke);
} else {
console.log(joke.setup);
setTimeout(() => {
console.log(joke.delivery);
}, 3000);
}
});
import requests
url = "https://v2.jokeapi.dev/joke/Programming,Misc"
params = {
"blacklistFlags": "nsfw,religious,racist",
"type": "single",
"format": "json"
}
response = requests.get(url, params=params)
joke = response.json()
if joke["type"] == "single":
print(joke["joke"])
else:
print(joke["setup"])
# 延迟后显示 delivery
print(joke["delivery"])
curl -s "https://v2.jokeapi.dev/joke/Programming?format=txt&type=single&blacklistFlags=nsfw,religious,racist"
Retry-After - 多少秒后重置RateLimit-Limit - 每分钟最大请求数RateLimit-Remaining - 剩余请求数API 返回统一格式的错误响应:
{
"error": true,
"internalError": false,
"code": 106,
"message": "No matching joke found",
"causedBy": ["No jokes were found that match your provided filter(s)"],
"additionalInfo": "The specified category is invalid...",
"timestamp": 1579170794412
}
200 - 成功201 - 提交成功400 - 请求格式错误403 - 被黑名单封锁404 - URL 不存在429 - 请求过多500 - 服务器内部错误⚠️ JokeAPI 包含多种类型的笑话,有些可能被视为冒犯性内容。建议:
safe-mode 参数blacklistFlags 过滤不当内容