其他
rankings & v1

2025-04-26 14:00:30

Start Me
Pasta

累计调用:71238

头像
客源
未开源

专注于企业级API开发与架构设计,5年以上开发经验

自定义排行榜

GET

自定义统计排行榜,一键获取排行榜信息

接口地址: https://api.qster.top/API/v1/rankings
接口示例: https://api.qster.top/API/v1/rankings/?id=1&type=text&name=吃鸡&time=2024-09-26

请求参数

参数名 类型 必填 说明
id string 专属标识,可以弄复杂一点或者自己qq号
user string 用户标识,可以弄qq号,存在时是增加次数,不存在时是查看排行榜
name string 排行榜的名称,默认为发言排行榜
n string 换行符号,默认
time string 查看时间,默认今天,格式为2024-09-26
g string 排行榜榜数,默认显示第十名
qskey string 申请临时密钥

响应参数

参数 说明
time 当前时间
data.date 当前时间排行榜
data.totalUsers 总用户
data.排行榜.user 用户名称
data.排行榜.counts 用户记录次数
code 200正常400失败 查看更多

代码示例

<?php
// 要调用的 URL
$url = "https://api.qster.top/API/v1/rankings";

// 参数数组
$params = [
"id" => "专属标识,可以弄复杂一点或者自己qq号",
"user" => "用户标识,可以弄qq号,存在时是增加次数,不存在时是查看排行榜",
"name" => "排行榜的名称,默认为发言排行榜",
"n" => "换行符号,默认
",
"time" => "查看时间,默认今天,格式为2024-09-26",
"g" => "排行榜榜数,默认显示第十名",
"qskey" => "0",
];

// 使用 http_build_query 将参数转换为查询字符串
$queryString = http_build_query($params);

// 在 URL 中添加查询字符串
$finalUrl = $url . '?' . $queryString;

// 使用 file_get_contents 获取内容
$response = file_get_contents($finalUrl);

// 输出响应
echo $response;
?>

import requests

url = "https://api.qster.top/API/v1/rankings";
params = {
"id" : "专属标识,可以弄复杂一点或者自己qq号",
"user" : "用户标识,可以弄qq号,存在时是增加次数,不存在时是查看排行榜",
"name" : "排行榜的名称,默认为发言排行榜",
"n" : "换行符号,默认
",
"time" : "查看时间,默认今天,格式为2024-09-26",
"g" : "排行榜榜数,默认显示第十名",
"qskey" => "0"
}
response = requests.get(url, params=params)
print(response.text)

function fetchData(url, params) {

const queryString = Object.keys(params)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
.join('&');
const fullUrl = `${url}?${queryString}`;

fetch(fullUrl)
.then(response => response.text())
.then(data => {
const resultElement = document.createElement('pre');
resultElement.textContent = data;
document.body.appendChild(resultElement);
})
.catch(error => console.error('Error fetching data:', error));
}

// 示例用法
const url = "https://api.qster.top/API/v1/rankings";
const params = {
"id" : "专属标识,可以弄复杂一点或者自己qq号",
"user" : "用户标识,可以弄qq号,存在时是增加次数,不存在时是查看排行榜",
"name" : "排行榜的名称,默认为发言排行榜",
"n" : "换行符号,默认
",
"time" : "查看时间,默认今天,格式为2024-09-26",
"g" : "排行榜榜数,默认显示第十名",
"qskey" => "0"
};
fetchData(url, params);

在线调试