← 返回 Skills 市场
djttt

Joke Api

作者 Djttt · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
304
总下载
0
收藏
4
当前安装
2
版本数
在 OpenClaw 中安装
/install joke-api
功能描述
Access diverse jokes by category, language, and type with filters for safe content using the free JokeAPI without requiring registration or an API key.
使用说明 (SKILL.md)

JokeAPI Skill

获取各种类型的幽默笑话,支持分类、语言、格式过滤。

概述

使用 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"

API 端点

主要端点

  • 基础 URL: https://v2.jokeapi.dev
  • 获取笑话: GET /joke/{categories}
  • 获取信息: GET /info
  • 获取分类: GET /categories
  • 获取语言: GET /languages

可用分类

  • Any - 随机分类
  • Misc - 杂项
  • Programming - 编程
  • Dark - 黑暗幽默
  • Pun - 双关语
  • Spooky - 恐怖
  • Christmas - 圣诞

过滤标志 (blacklistFlags)

  • nsfw - 不适宜工作场所
  • religious - 宗教
  • political - 政治
  • racist - 种族主义
  • sexist - 性别歧视
  • explicit - 露骨内容

响应格式

  • json (默认)
  • xml
  • yaml
  • txt (纯文本)

示例代码

JavaScript/Node.js

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);
    }
  });

Python

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"])

Bash

curl -s "https://v2.jokeapi.dev/joke/Programming?format=txt&type=single&blacklistFlags=nsfw,religious,racist"

速率限制

  • 每分钟最多 120 次请求
  • 超出限制会返回 HTTP 429 错误
  • 响应头包含速率限制信息:
    • 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
}

HTTP 状态码

  • 200 - 成功
  • 201 - 提交成功
  • 400 - 请求格式错误
  • 403 - 被黑名单封锁
  • 404 - URL 不存在
  • 429 - 请求过多
  • 500 - 服务器内部错误

注意事项

⚠️ JokeAPI 包含多种类型的笑话,有些可能被视为冒犯性内容。建议:

  • 启用 safe-mode 参数
  • 使用 blacklistFlags 过滤不当内容
  • 根据使用场景选择合适的分类

相关链接

安全使用建议
This skill appears to be a simple client for the public JokeAPI. Before installing or running: (1) review the two provided scripts yourself — they are short and only perform HTTPS requests to jokeapi.dev; (2) note there is no automatic installer or declared binaries: the scripts expect python3 and curl and won't be added to your PATH unless you do so manually; (3) the skill makes outbound network requests to jokeapi.dev (so your queries/texts are sent to that service) and JokeAPI can return offensive content unless you enable safe-mode/blacklist flags; and (4) the package source has no homepage listed—if you want greater assurance, fetch the official client from the JokeAPI GitHub or run the included scripts in an isolated environment first.
功能分析
Type: OpenClaw Skill Name: joke-api Version: 1.0.1 The skill bundle provides a legitimate interface for the JokeAPI (https://v2.jokeapi.dev) through Bash and Python scripts. Analysis of scripts/joke.sh and scripts/joke.py shows standard API interaction patterns, safe input handling (URL encoding), and no evidence of malicious behavior, data exfiltration, or prompt injection.
能力评估
Purpose & Capability
The skill's name/description (Joke API client) match the included files and instructions. Minor mismatch: the SKILL.md and README show a 'joke' CLI command and the repo includes scripts (scripts/joke.py and scripts/joke.sh), but there is no install step or declared required binaries. The scripts assume python3 and curl are available and that the user will run the scripts or install them to PATH; these runtime dependencies are not declared in the registry metadata.
Instruction Scope
SKILL.md instructs only how to call the public JokeAPI endpoints and contains sample code (Node/Python/Bash). The runtime instructions and included scripts only perform outbound HTTP requests to the official JokeAPI domain and process responses; they do not read local credentials, system files, or send data to other endpoints.
Install Mechanism
No install spec is provided (lowest-risk category). Because code files are included but no installer is declared, the scripts will not be automatically placed on PATH; a user must run them directly or install them manually. This is a functional oddity but not a security risk by itself.
Credentials
The skill requests no environment variables, keys, or config paths. The scripts only make network calls to https://v2.jokeapi.dev. No credentials or unrelated service tokens are requested or used.
Persistence & Privilege
Skill flags are default (always: false, model invocation allowed). The skill does not request persistent presence or modify other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install joke-api
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /joke-api 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Initial metadata file (_meta.json) added for the skill. - No changes to functionality or documentation.
v1.0.0
- Initial release of JokeAPI Skill. - Fetch random jokes with support for category, type, language, and content filtering. - Integrates with JokeAPI without needing an API key. - Allows format selection (json, xml, yaml, txt) and rate limit awareness. - Includes sample code for JavaScript, Python, and Bash. - Supports safe-mode and blacklist filters to exclude inappropriate content.
元数据
Slug joke-api
版本 1.0.1
许可证 MIT-0
累计安装 4
当前安装数 4
历史版本数 2
常见问题

Joke Api 是什么?

Access diverse jokes by category, language, and type with filters for safe content using the free JokeAPI without requiring registration or an API key. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 304 次。

如何安装 Joke Api?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install joke-api」即可一键安装,无需额外配置。

Joke Api 是免费的吗?

是的,Joke Api 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Joke Api 支持哪些平台?

Joke Api 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Joke Api?

由 Djttt(@djttt)开发并维护,当前版本 v1.0.1。

💬 留言讨论