← Back to Skills Marketplace
djttt

Chinese Joke Api

by Djttt · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
275
Downloads
0
Stars
3
Active Installs
1
Versions
Install in OpenClaw
/install chinese-joke-api
Description
Fetches humorous Chinese jokes using third-party APIs like Hitokoto and JokeAPI with error handling and timeout support.
README (SKILL.md)

Chinese Joke API Skill

概述

这个 skill 使用第三方中文笑话 API 获取有趣的中式幽默。

API 源

1. 一言 API (Hitokoto)

特点: 包含各种类型的中文短句,包括笑话

基础 URL: https://v1.hitokoto.cn

用法:

curl "https://v1.hitokoto.cn?c=j"

参数:

  • c=j - 搞笑类别
  • c=a - 动画
  • c=b - 漫画
  • c=c - 原创

2. 简短笑话 API

特点: 专门的笑话 API,返回中文短笑话

基础 URL: https://api.jokeapi.cn

用法:

curl "https://api.jokeapi.cn/joke/Any?safe-mode"

快速开始

使用 Bash

# 获取一言搞笑
curl -s "https://v1.hitokoto.cn?c=j" | python3 -m json.tool

# 获取简短笑话
curl -s "https://api.jokeapi.cn/joke/Any?safe-mode" | python3 -m json.tool

使用 Python

import requests

# 一言搞笑
resp = requests.get("https://v1.hitokoto.cn?c=j")
data = resp.json()
print(f"{data['hitokoto']} - {data['from']}")

# 简短笑话
resp = requests.get("https://api.jokeapi.cn/joke/Any?safe-mode")
data = resp.json()
if data['type'] == 'single':
    print(data['joke'])
else:
    print(data['setup'])
    print(data['delivery'])

示例代码

Bash 脚本

#!/bin/bash
# 获取一言搞笑
curl -s "https://v1.hitokoto.cn?c=j" | python3 -c "
import sys, json
d = json.load(sys.stdin)
print(f'「{d['hitokoto']}」')
print(f'—— {d.get('from_') or d.get('from')}')
"

Python 脚本

#!/usr/bin/env python3
import requests
import json

def get_chinese_joke():
    """获取中文笑话"""
    try:
        # 尝试一言 API
        resp = requests.get("https://v1.hitokoto.cn?c=j", timeout=5)
        data = resp.json()
        print(f"「{data['hitokoto']}」")
        print(f"—— {data.get('from_', data.get('from'))}")
        return True
    except Exception as e:
        print(f"获取失败:{e}")
        return False

if __name__ == "__main__":
    get_chinese_joke()

注意事项

⚠️ 这些 API 都是第三方服务,可用性可能不稳定:

  • 一言 API:偶尔响应慢
  • 简短笑话 API:可能有时限流

建议:

  • 添加错误处理
  • 设置超时
  • 考虑备用 API

相关链接

Usage Guidance
This skill appears coherent and low-risk: it calls public joke APIs and parses the JSON locally, requires no credentials, and includes a small bash helper. Before installing, ensure you are comfortable with the skill making outbound HTTP requests from your environment (network access required). Review the provided script if you run it locally (the SKILL.md has a quoting error in one example but the included script is correct). If you care about privacy or rate limits, note that requests go to third-party endpoints (Hitokoto and jokeapi.cn) and those services will see the request metadata; no user secrets are sent by the skill.
Capability Analysis
Type: OpenClaw Skill Name: chinese-joke-api Version: 1.0.0 The skill is a straightforward implementation for fetching jokes from public APIs (v1.hitokoto.cn and api.jokeapi.cn). The code in SKILL.md and scripts/chinese-joke.sh performs standard HTTP GET requests and JSON parsing without any signs of data exfiltration, malicious execution, or prompt injection.
Capability Assessment
Purpose & Capability
Name/description match the included SKILL.md and scripts: both use Hitokoto and JokeAPI endpoints to fetch jokes. No unrelated binaries, env vars, or config paths are requested.
Instruction Scope
Instructions only describe network requests to the stated third-party APIs and local parsing with Python; they do not read unrelated files, request credentials, or send data to unexpected endpoints. (Note: the SKILL.md contains a quoting mistake in one Bash example that would break if copied verbatim; the shipped script is correctly quoted.)
Install Mechanism
No install spec — instruction-only with a small included bash script; nothing is downloaded from external or untrusted URLs and nothing is written to disk beyond the provided script.
Credentials
No environment variables, secrets, or external credentials are requested or needed; the APIs used are public and the script sets a reasonable curl timeout.
Persistence & Privilege
The skill does not request persistent/always-on privileges, does not modify other skills or system settings, and is user-invocable by default.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install chinese-joke-api
  3. After installation, invoke the skill by name or use /chinese-joke-api
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of the Chinese Joke API skill. - Integrates two third-party APIs: Hitokoto (一言) for various types of Chinese short phrases including jokes, and jokeapi.cn for short Chinese jokes. - Provides easy usage instructions and example code in both Bash and Python. - Includes recommendations for error handling and notes about third-party API availability.
Metadata
Slug chinese-joke-api
Version 1.0.0
License MIT-0
All-time Installs 3
Active Installs 3
Total Versions 1
Frequently Asked Questions

What is Chinese Joke Api?

Fetches humorous Chinese jokes using third-party APIs like Hitokoto and JokeAPI with error handling and timeout support. It is an AI Agent Skill for Claude Code / OpenClaw, with 275 downloads so far.

How do I install Chinese Joke Api?

Run "/install chinese-joke-api" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Chinese Joke Api free?

Yes, Chinese Joke Api is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Chinese Joke Api support?

Chinese Joke Api is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Chinese Joke Api?

It is built and maintained by Djttt (@djttt); the current version is v1.0.0.

💬 Comments