接入教程
GET https://unofficialurbandictionaryapi.com/api/random1. 随机词条:
2. 查询特定词:/api/define?term=word。
3. 返回data数组,含word、definition、example字段。
4. 内容多为用户贡献,可能包含粗俗表达,注意过滤。
Python 查询俚语
python
import requests
r = requests.get("https://unofficialurbandictionaryapi.com/api/define", params={"term":"cool"})
d = r.json()["data"][0]
print(d["word"], ":", d["definition"])
PHP 查询俚语
php
<?php
$d = json_decode(file_get_contents("https://unofficialurbandictionaryapi.com/api/define?term=cool"), true);
echo $d["data"][0]["definition"];
JavaScript 查询俚语
javascript
const d = await fetch("https://unofficialurbandictionaryapi.com/api/define?term=cool").then(r => r.json());
console.log(d.data[0].definition);
常见问题
免费吗?
100%免费、开源、无速率限制、无需注册。
内容安全吗?
内容由社区贡献,可能包含粗俗或敏感表达,建议业务侧做内容过滤。
Aitishiku.com