|
尽快登录注册
您需要 登录 才可以下载或查看,没有账号?立即注册
x
获取随机小姐姐视频
接口地址:https://api.kuleu.com/api/xjj
返回格式:json
请求方式:get/post
请求示例:https://api.kuleu.com/api/xjj?type=json- <!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>
复制代码
chatgpt生成的html代码调用:如上
随机猫咪图片
接口地址:https://api.thecatapi.com/v1/images/search 33
返回格式:json
请求方式:get
请求示例:https://api.thecatapi.com/v1/images/search?limit=1 42
示例html:无 |
|