https://api.cenguigui.cn/api/juhe/
GET
JSON
正常启用
以下参数为接口所需调用信息
参数 | 是否必填 | 说明 | |
---|---|---|---|
type | code | 无 | 输入返回格式:默认json可选text、js或者json |
msg | string | 无 | 安慰语录、QQ签名、趣味笑话、随机一言、英汉语录、毒鸡汤、爱情语录、文案温柔、伤感语录、舔狗日记、社会语录、诗词、骚话、经典语录、情话、人生话语、我在人间凑数的日子、网易语录,(默认随机一言) |
https://api.cenguigui.cn/api/juhe/?msg=毒鸡汤&type=json
<script type="text/javascript" src="https://api.cenguigui.cn/api/juhe/?msg=毒鸡汤type=text"></script> https://api.cenguigui.cn/api/juhe/?msg=毒鸡汤&type=json //html代码调用示例: <p id="text"></p> <script> // 选择用于显示文字的元素 var textElement = document.getElementById('text'); // 发起 HTTP 请求并获取接口返回的数据 fetch('https://api.cenguigui.cn/api/juhe/?msg=毒鸡汤&type=json') .then(function(response) { return response.json(); // 将响应数据解析为 JSON 对象 }) .then(function(data) { // 将返回的数据中的文字部分赋值给显示文字的元素 textElement.innerText = data.text; }) .catch(function(error) { console.log(error); }); </script>