分享两个有趣的api

1.获取随机小姐姐视频
接口地址:https://api.kuleu.com/api/xjj
返回格式:json
请求方式:get/post
请求示例:https://api.kuleu.com/api/xjj?type=json
chatgpt生成的html代码调用:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>API Video Player</title>
</head>
<body>
    <h1>随机视频播放</h1>
    <div id="videoContainer">
        <video id="videoPlayer" controls>
            您的浏览器不支持HTML5视频播放。
        </video>
    </div>
    <button id="loadVideoButton">加载新视频</button>

    <script>
        // API URL
        const apiUrl = "https://api.kuleu.com/api/xjj?type=json";

        // Function to fetch the video URL from the API
        function loadVideo() {
            fetch(apiUrl)
                .then(response => response.json())
                .then(data => {
                    if (data.code === 200) {
                        const videoUrl = data.video;
                        const videoPlayer = document.getElementById("videoPlayer");
                        videoPlayer.src = videoUrl;
                    } else {
                        console.error("无法获取视频:", data.msg);
                    }
                })
                .catch(error => {
                    console.error("请求错误:", error);
                });
        }

        // Event listener for the button
        document.getElementById("loadVideoButton").addEventListener("click", loadVideo);
    </script>
</body>
</html>

  1. 随机猫咪图片
    接口地址:https://api.thecatapi.com/v1/images/search
    返回格式:json
    请求方式:get
    请求示例:https://api.thecatapi.com/v1/images/search?limit=1
    示例html:
    photo.zip (958 字节)

(第二个写得挺有品味的)求赞 :crazy_face: :crazy_face:

8 个赞

猫咪api好耶

1 个赞

Mark,以备不时之需

1 个赞

api收藏了

1 个赞

mark从未停止,使用从未开始

1 个赞

可以看看随机猫咪图片那个gpt写的代码,写得挺好的

mark mark

1 个赞

毫不炫耀的说,我以前也搞过。去抖音爬视频

1 个赞

https://baobaowangze.github.io

对第一个优化体验,手机端刷视频应该很丝滑

7 个赞

你做得非常好,这个帖子很有意义!

1 个赞

不错不错,感谢分享

3 个赞

mark了。

:joy:都不知道咋面对你们了 :rofl: :rofl:

1 个赞

哈哈哈 :laughing: :laughing: :laughing:

被始皇制裁后学到了东西 不能回帖子 :rofl:除非对方发问 不然回帖会被当成骚扰 :rofl:

mark一下,佬儿还有没有这种类似的奇奇怪怪的api推荐,最近特别喜欢收集这些api

美化了一下界面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>API Video Player</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
        }
        h1 {
            color: #333;
        }
        #videoContainer {
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        #videoPlayer {
            max-width: 100%;
            border-radius: 10px;
        }
        #loadVideoButton {
            margin-top: 20px;
            padding: 10px 20px;
            font-size: 16px;
            color: #fff;
            background-color: #007bff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        #loadVideoButton:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
    <h1>随机视频播放</h1>
    <div id="videoContainer">
        <video id="videoPlayer" controls>
            您的浏览器不支持HTML5视频播放。
        </video>
    </div>
    <button id="loadVideoButton">加载新视频</button>

    <script>
        // API URL
        const apiUrl = "https://api.kuleu.com/api/xjj?type=json";

        // Function to fetch the video URL from the API
        function loadVideo() {
            fetch(apiUrl)
                .then(response => response.json())
                .then(data => {
                    if (data.code === 200) {
                        const videoUrl = data.video;
                        const videoPlayer = document.getElementById("videoPlayer");
                        videoPlayer.src = videoUrl;
                    } else {
                        console.error("无法获取视频:", data.msg);
                    }
                })
                .catch(error => {
                    console.error("请求错误:", error);
                });
        }

        // Event listener for the button
        document.getElementById("loadVideoButton").addEventListener("click", loadVideo);
    </script>
</body>
</html>

哪个佬加工一下,等签名链接 :rofl:

api1


自古逢秋悲寂寥,我言秋日胜春朝。—— 刘禹锡