QQ信息查询源码

V 小归客 (UID: 1719) [复制链接]
帖子链接已复制到剪贴板
帖子已经有人评论啦,不支持删除!

985 7

使用了寂寞API提供的接口。我看他的API都没人怎么用,我给他用起来,哈哈。能查询QQ等级,注册时间,Q龄

图片演示:

我直接放主题里测试的,css会有冲突,前端可能有点丑,自己美化一下就好。

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>查询QQ用户信息</title>
<style>
  body {
    font-family: Arial, sans-serif;
    padding: 20px;
  }
  .container {
    max-width: 600px;
    margin: 0 auto;
  }
  input, button {
    padding: 10px;
    margin-top: 10px;
    font-size: 16px;
  }
</style>
</head>
<body>
<div class="container">
  <h2>查询QQ用户信息</h2>
  <input type="text" id="qqNumber" placeholder="请输入QQ号码">
  <button onclick="fetchUserData()">查询</button>
  <div id="result">
    <!-- 结果将在这里显示 -->
  </div>
</div>

<script>
function fetchUserData() {
  const qqNumber = document.getElementById('qqNumber').value;
  const apiUrl = `https://api.jmjm.tk/api/qqzcdj/?qq=${qqNumber}`;
  
  // 使用Fetch API发送请求
  fetch(apiUrl)
    .then(response => {
      if (!response.ok) {
        throw new Error('Network response was not ok');
      }
      return response.json();
    })
    .then(data => {
      displayResult(data);
    })
    .catch(error => {
      console.error('There has been a problem with your fetch operation:', error);
      document.getElementById('result').innerText = '请求失败: ' + error.message;
    });
}

function displayResult(data) {
  const resultDiv = document.getElementById('result');
  if (data.status === 'success') {
    resultDiv.innerHTML = `
      <p><strong>QQ号:</strong> ${data.user_id}</p>
      <p><strong>昵称:</strong> ${data.nickname}</p>
      <p><strong>QQ等级:</strong> ${data.qqLevel}</p>
      <p><strong>注册时间:</strong> ${data.reg_time}</p>
      <p><strong>QQ年龄:</strong> ${data.qq_age}</p>
    `;
  } else {
    resultDiv.innerHTML = '<p>查询失败,请检查输入的QQ号码是否正确。</p>';
  }
}
</script>
</body>
</html>

 

这家伙太懒了,什么也没留下。
已有评论 ( 7 )
提示:您必须 登录 才能查看此内容。
创建新帖
自助推广点击空位自助购买TG联系
确认删除
确定要删除这篇帖子吗?删除后将无法恢复。
删除成功
帖子已成功删除,页面将自动刷新。
删除失败
删除帖子时发生错误,请稍后再试。