关于 utility-tools
通过 API 提供常见查询与内容生成能力的技能,涵盖翻译、IP 和 WHOIS 查询、二维码、哈希、Open Graph 元数据及密码生成。
主要功能
- 01查询 IP 位置和 ISP
- 02多语言文本翻译
- 03根据文本或 URL 生成二维码
- 04计算 MD5、SHA1、SHA256 和 SHA512
- 05提取 Open Graph 元数据并查询 WHOIS
- 06按条件生成密码
适用场景
- 01在支持的语言之间翻译文本
- 02为 URL 创建二维码
- 03生成密码哈希或随机密码
- 04根据网页元数据制作链接预览
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ vikiboss/ 60s-skills --skill utility-tools安装后在 Claude Code 中输入/utility-tools确认已加载。
详细介绍
实用工具技能
此技能提供多种实用功能,可用于翻译、IP 查询、二维码生成等常见任务。
可用工具
- IP 地址查询 - 获取任意 IP 的位置和 ISP 信息
- 文本翻译 - 在多种语言之间进行翻译
- 二维码生成 - 为任意文本或 URL 创建二维码
- 哈希计算 - 计算 MD5、SHA1、SHA256、SHA512
- OG 元数据提取 - 从 URL 提取 Open Graph 元数据
- WHOIS 查询 - 获取域名注册信息
- 密码生成 - 生成安全的随机密码
API 端点
| 工具 | 端点 | 方法 |
|---|---|---|
| IP 查询 | /v2/ip | GET |
| 翻译 | /v2/fanyi | POST |
| 二维码 | /v2/qrcode | GET |
| 哈希 | /v2/hash | POST |
| OG 元数据 | /v2/og | POST |
| WHOIS | /v2/whois | GET |
| 密码 | /v2/password | GET |
1. IP 地址查询
import requests
# Lookup specific IP
response = requests.get('https://60s.viki.moe/v2/ip', params={'ip': '8.8.8.8'})
ip_info = response.json()
print(f"IP: {ip_info['ip']}")
print(f"Location: {ip_info['location']}")
print(f"ISP: {ip_info['isp']}")
# Get your own IP info (no params)
my_ip = requests.get('https://60s.viki.moe/v2/ip').json()
2. 文本翻译
# Translate text
data = {
'text': 'Hello World',
'from': 'en', # or 'auto' for auto-detection
'to': 'zh' # target language
}
response = requests.post('https://60s.viki.moe/v2/fanyi', json=data)
translation = response.json()
print(f"Original: {translation['text']}")
print(f"Translated: {translation['result']}")
print(f"From: {translation['from']} To: {translation['to']}")
支持的语言:
zh- 中文en- 英语ja- 日语ko- 韩语fr- 法语de- 德语es- 西班牙语ru- 俄语- 以及更多……
# Get supported languages
response = requests.post('https://60s.viki.moe/v2/fanyi/langs')
languages = response.json()
3. 二维码生成
# Generate QR code
params = {
'text': 'https://github.com/vikiboss/60s',
'size': 300 # pixels, default 200, min 50, max 1000
}
response = requests.get('https://60s.viki.moe/v2/qrcode', params=params)
# Save the QR code image
with open('qrcode.png', 'wb') as f:
f.write(response.content)
4. 哈希计算
# Calculate hash
data = {
'text': 'Hello World',
'algorithm': 'md5' # md5, sha1, sha256, sha512
}
response = requests.post('https://60s.viki.moe/v2/hash', json=data)
result = response.json()
print(f"Algorithm: {result['algorithm']}")
print(f"Hash: {result['hash']}")
5. OG 元数据提取
# Extract Open Graph metadata from URL
data = {'url': 'https://github.com/vikiboss/60s'}
response = requests.post('https://60s.viki.moe/v2/og', json=data)
metadata = response.json()
print(f"Title: {metadata['title']}")
print(f"Description: {metadata['description']}")
print(f"Image: {metadata['image']}")
print(f"URL: {metadata['url']}")
6. WHOIS 查询
# Domain WHOIS information
params = {'domain': 'github.com'}
response = requests.get('https://60s.viki.moe/v2/whois', params=params)
whois_info = response.json()
print(f"Domain: {whois_info['domain']}")
print(f"Registrar: {whois_info['registrar']}")
print(f"Created: {whois_info['created_date']}")
print(f"Expires: {whois_info['expiration_date']}")
7. 密码生成
# Generate secure password
params = {
'length': 16, # 6-128
'numbers': True, # include numbers
'lowercase': True, # include lowercase
'uppercase': True, # include uppercase
'symbols': True # include special characters
}
response = requests.get('https://60s.viki.moe/v2/password', params=params)
password_data = response.json()
print(f"Password: {password_data['password']}")
print(f"Strength: {password_data['strength']}")
示例用例
多语言聊天机器人
def auto_translate(text, target_lang='zh'):
data = {
'text': text,
'from': 'auto',
'to': target_lang
}
response = requests.post('https://60s.viki.moe/v2/fanyi', json=data)
return response.json()['result']
# Usage
user_input = "Hello, how are you?"
translated = auto_translate(user_input, 'zh')
print(translated) # 你好,你好吗?
带二维码的 URL 缩短工具
def create_qr_for_url(url, size=200):
params = {'text': url, 'size': size}
response = requests.get('https://60s.viki.moe/v2/qrcode', params=params)
return response.content
# Generate and save
qr_image = create_qr_for_url('https://example.com')
with open('url_qr.png', 'wb') as f:
f.write(qr_image)
安全工具
def check_password_hash(password):
"""Generate multiple hashes for password"""
algorithms = ['md5', 'sha1', 'sha256', 'sha512']
hashes = {}
for algo in algorithms:
data = {'text': password, 'algorithm': algo}
response = requests.post('https://60s.viki.moe/v2/hash', json=data)
hashes[algo] = response.json()['hash']
return hashes
def generate_secure_password(length=16):
params = {
'length': length,
'numbers': True,
'lowercase': True,
'uppercase': True,
'symbols': True
}
response = requests.get('https://60s.viki.moe/v2/password', params=params)
return response.json()['password']
网站预览卡片
def get_link_preview(url):
"""Get rich preview data for a URL"""
data = {'url': url}
response = requests.post('https://60s.viki.moe/v2/og', json=data)
og = response.json()
preview = f"""
📄 {og['title']}
📝 {og['description']}
🖼️ {og['image']}
🔗 {og['url']}
"""
return preview
最佳实践
- 翻译:不确定源语言时,请使用 'auto'
- 二维码:大多数情况下,尺寸保持在 200-500px 之间
- 哈希:安全应用请使用 SHA256 或 SHA512
- 密码:始终使用所有字符类型,以生成强密码
- 错误处理:始终验证输入并处理 API 错误
示例交互
用户:“把这段话翻译成英文:你好世界”
data = {'text': '你好世界', 'from': 'zh', 'to': 'en'}
response = requests.post('https://60s.viki.moe/v2/fanyi', json=data)
print(response.json()['result']) # Hello World
用户:“生成一个强密码”
params = {'length': 20, 'symbols': True, 'uppercase': True, 'lowercase': True, 'numbers': True}
response = requests.get('https://60s.viki.moe/v2/password', params=params)
print(f"🔐 生成的密码:{response.json()['password']}")
用户:“查询这个 IP 地址的位置:1.1.1.1”
response = requests.get('https://60s.viki.moe/v2/ip', params={'ip': '1.1.1.1'})
info = response.json()
print(f"📍 IP: {info['ip']}")
print(f"🌍 位置: {info['location']}")
print(f"🏢 运营商: {info['isp']}")
相关资源
评论
支持 Markdown