<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p id="hitokoto"><a href="#" id="hitokoto_text">:D 获取中...</a></p>
<script>
fetchText()
setInterval(() => {
fetchText()
}, 3000)
function fetchText() {
console.log('11');
fetch('https://v1.hitokoto.cn')
.then(response => response.json())
.then(data => {
const hitokoto = document.getElementById('hitokoto_text')
hitokoto.href = 'https://hitokoto.cn/?uuid=' + data.uuid
hitokoto.innerText = data.hitokoto
})
.catch(console.error)
}
</script>
</body>
</html>
一言接口使用
最新推荐文章于 2024-01-27 11:49:07 发布