版本 1.0 · 更新时间:2025-10-31
关于本 API
彩票开奖数据 API 提供全面的彩票开奖信息查询服务,覆盖 179 个主流彩种,数据每分钟自动更新。 所有接口均采用 RESTful 设计规范,返回标准 JSON 格式数据。
基础信息
| 基础 URL | https://lottery.langne.com |
| 协议 | HTTPS (TLS 1.2+) |
| 数据格式 | JSON |
| 字符编码 | UTF-8 |
服务特性
| 认证方式 | 无需认证 |
| 访问限制 | 无限制 |
| CORS 支持 | ✅ 完全支持 |
| 更新频率 | 每分钟 |
🎉 完全开放,无需认证
本 API 完全免费开放,无需注册账号,无需申请 API Key,无需任何认证流程。 您可以直接在客户端代码中调用 API,支持跨域请求(CORS)。
GET /api/lottery-types获取系统支持的所有彩种列表,包括彩种代码、名称、类型等基本信息。
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
active | boolean | 否 | true | 是否只返回活跃彩种 |
type | string | 否 | - | 按类型筛选(standard/vietnamese/blockchain等) |
获取所有活跃彩种:
curl -X GET "https://lottery.langne.com/api/lottery-types?active=true" \ -H "Accept: application/json"
获取特定类型的彩种:
curl -X GET "https://lottery.langne.com/api/lottery-types?type=vietnamese" \ -H "Accept: application/json"
{
"success": true,
"data": [
{
"lottery_code": "CQSSC",
"lottery_name": "重庆时时彩",
"lottery_type": "standard",
"is_active": true,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-10-31T12:00:00Z"
},
{
"lottery_code": "HNFC",
"lottery_name": "河内五分彩",
"lottery_type": "vietnamese",
"is_active": true,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-10-31T12:00:00Z"
}
],
"total": 179,
"timestamp": "2025-10-31T14:30:00Z"
}| 字段名 | 类型 | 说明 |
|---|---|---|
success | boolean | 请求是否成功 |
data | array | 彩种数据数组 |
data[].lottery_code | string | 彩种唯一标识代码 |
data[].lottery_name | string | 彩种中文名称 |
data[].lottery_type | string | 彩种类型(standard/vietnamese/blockchain等) |
total | number | 总彩种数量 |
GET /api/lottery-results获取指定彩种的历史开奖记录,支持分页查询和日期筛选。此接口已进行 S 级性能优化,响应时间 < 100ms。
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
lottery_code | string | 是 | - | 彩种代码(如:CQSSC) |
page | integer | 否 | 1 | 页码,从 1 开始 |
limit | integer | 否 | 20 | 每页条数,范围:1-100 |
date | string | 否 | - | 日期筛选,格式:YYYY-MM-DD |
start_date | string | 否 | - | 开始日期,格式:YYYY-MM-DD |
end_date | string | 否 | - | 结束日期,格式:YYYY-MM-DD |
基础查询(获取重庆时时彩最新 20 条):
curl -X GET "https://lottery.langne.com/api/lottery-results?lottery_code=CQSSC" \ -H "Accept: application/json"
分页查询(第 2 页,每页 50 条):
curl -X GET "https://lottery.langne.com/api/lottery-results?lottery_code=CQSSC&page=2&limit=50" \ -H "Accept: application/json"
日期筛选(获取指定日期的数据):
curl -X GET "https://lottery.langne.com/api/lottery-results?lottery_code=CQSSC&date=2025-10-31" \ -H "Accept: application/json"
日期范围查询:
curl -X GET "https://lottery.langne.com/api/lottery-results?lottery_code=CQSSC&start_date=2025-10-01&end_date=2025-10-31" \ -H "Accept: application/json"
{
"success": true,
"data": [
{
"id": 123456,
"lottery_code": "CQSSC",
"issue": "20251031-100",
"official_issue": "20251031100",
"open_date": "2025-10-31 22:30:00",
"code": "1,2,3,4,5",
"created_at": "2025-10-31T22:30:05Z",
"updated_at": "2025-10-31T22:30:05Z"
},
{
"id": 123455,
"lottery_code": "CQSSC",
"issue": "20251031-099",
"official_issue": "20251031099",
"open_date": "2025-10-31 22:20:00",
"code": "5,4,3,2,1",
"created_at": "2025-10-31T22:20:05Z",
"updated_at": "2025-10-31T22:20:05Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 1000,
"totalPages": 50
},
"performance": {
"query_time_ms": 45
},
"timestamp": "2025-10-31T22:35:00Z"
}| 字段名 | 类型 | 说明 |
|---|---|---|
data[].id | integer | 记录唯一 ID |
data[].lottery_code | string | 彩种代码 |
data[].issue | string | 期号(统一格式) |
data[].official_issue | string | 官方期号(原始格式) |
data[].open_date | string | 开奖时间(本地时区) |
data[].code | string/object | 开奖号码(格式因彩种类型而异) |
pagination | object | 分页信息 |
performance.query_time_ms | integer | 查询耗时(毫秒) |
GET /api/lottery-results/latest快速获取指定彩种的最新一期开奖结果,适用于需要实时展示最新开奖的场景。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
lottery_code | string | 是 | 彩种代码 |
curl -X GET "https://lottery.langne.com/api/lottery-results/latest?lottery_code=CQSSC" \ -H "Accept: application/json"
{
"success": true,
"data": {
"id": 123456,
"lottery_code": "CQSSC",
"issue": "20251031-100",
"official_issue": "20251031100",
"open_date": "2025-10-31 22:30:00",
"code": "1,2,3,4,5",
"created_at": "2025-10-31T22:30:05Z"
},
"timestamp": "2025-10-31T22:35:00Z"
}GET /api/statistics获取平台整体统计数据,包括彩种数量、开奖记录总数、最新开奖信息等。
curl -X GET "https://lottery.langne.com/api/statistics" \ -H "Accept: application/json"
{
"success": true,
"summary": {
"total_lottery_types": 179,
"total_results": 125000,
"lottery_type_categories": 7,
"latest_draw": {
"time": "2025-10-31T22:30:00Z",
"lottery_code": "CQSSC",
"issue": "20251031-100",
"time_ago": "5分钟前"
}
},
"timestamp": "2025-10-31T22:35:00Z"
}所有 API 响应均采用统一的 JSON 格式,包含以下标准字段:
{
"success": boolean, // 请求是否成功
"data": object | array, // 响应数据(成功时)
"error": string, // 错误信息(失败时)
"message": string, // 详细描述(可选)
"timestamp": string // 响应时间戳(ISO 8601格式)
}不同类型的彩种,code 字段的格式有所不同:
标准格式(standard)
适用于:重庆时时彩、北京赛车、11选5等
"code": "1,2,3,4,5"
越南传统格式(vietnamese)
适用于:河内彩、胡志明彩等
"code": {
"first_prize": "12345",
"second_prize": "67890",
"special_prizes": ["11111", "22222"]
// ... 更多奖项
}区块链格式(blockchain)
适用于:以太坊彩、比特币彩等
"code": {
"code": "1,2,3,4,5",
"code_block": "23697768",
"code_hash": "0xfac6573055cc28809..."
}支持分页的接口会额外返回 pagination 对象:
"pagination": {
"page": 1, // 当前页码
"limit": 20, // 每页条数
"total": 1000, // 总记录数
"totalPages": 50 // 总页数
}| 状态码 | 说明 | 常见原因 |
|---|---|---|
200 | OK | 请求成功 |
400 | Bad Request | 请求参数错误或缺失必填参数 |
404 | Not Found | 请求的资源不存在(如彩种代码错误) |
500 | Internal Server Error | 服务器内部错误 |
503 | Service Unavailable | 服务暂时不可用(维护中) |
{
"success": false,
"error": "INVALID_LOTTERY_CODE",
"message": "彩种代码不存在或格式错误",
"details": {
"lottery_code": "INVALID_CODE",
"valid_codes_example": ["CQSSC", "HNFC", "BJPK10"]
},
"timestamp": "2025-10-31T22:35:00Z"
}| 错误代码 | 说明 | 解决方案 |
|---|---|---|
MISSING_PARAMETER | 缺少必填参数 | 检查请求参数,补充缺失的必填字段 |
INVALID_LOTTERY_CODE | 彩种代码无效 | 先调用获取彩种列表接口确认有效代码 |
INVALID_DATE_FORMAT | 日期格式错误 | 使用 YYYY-MM-DD 格式 |
INVALID_PAGE | 页码无效 | 页码必须大于 0 |
LIMIT_EXCEEDED | limit 参数超出范围 | limit 值应在 1-100 之间 |
🎉 当前无速率限制
为了方便开发者使用,本 API 目前不设置速率限制。我们保留在必要时实施合理限制的权利,届时会提前通知。
// 使用 async/await
async function getLotteryResults(lotteryCode, page = 1, limit = 20) {
try {
const response = await fetch(
`https://lottery.langne.com/api/lottery-results?lottery_code=${lotteryCode}&page=${page}&limit=${limit}`
);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
if (data.success) {
console.log(`获取到 ${data.data.length} 条记录`);
return data.data;
} else {
console.error('请求失败:', data.error);
return null;
}
} catch (error) {
console.error('网络错误:', error);
return null;
}
}
// 使用示例
getLotteryResults('CQSSC', 1, 50).then(results => {
if (results) {
results.forEach(item => {
console.log(`期号: ${item.issue}, 号码: ${item.code}`);
});
}
});
// 使用 axios
const axios = require('axios');
axios.get('https://lottery.langne.com/api/lottery-results', {
params: {
lottery_code: 'CQSSC',
page: 1,
limit: 20
}
})
.then(response => {
const data = response.data;
if (data.success) {
console.log('数据:', data.data);
}
})
.catch(error => {
console.error('Error:', error);
});import requests
from typing import Optional, Dict, List
class LotteryAPI:
BASE_URL = "https://lottery.langne.com"
def __init__(self):
self.session = requests.Session()
self.session.headers.update({
'Accept': 'application/json',
'User-Agent': 'LotteryClient/1.0'
})
def get_lottery_types(self, active: bool = True) -> Optional[List[Dict]]:
"""获取彩种列表"""
try:
response = self.session.get(
f"{self.BASE_URL}/api/lottery-types",
params={'active': active}
)
response.raise_for_status()
data = response.json()
return data.get('data') if data.get('success') else None
except requests.RequestException as e:
print(f"请求失败: {e}")
return None
def get_lottery_results(
self,
lottery_code: str,
page: int = 1,
limit: int = 20,
date: Optional[str] = None
) -> Optional[Dict]:
"""获取开奖结果"""
params = {
'lottery_code': lottery_code,
'page': page,
'limit': limit
}
if date:
params['date'] = date
try:
response = self.session.get(
f"{self.BASE_URL}/api/lottery-results",
params=params
)
response.raise_for_status()
return response.json()
except requests.RequestException as e:
print(f"请求失败: {e}")
return None
# 使用示例
if __name__ == "__main__":
api = LotteryAPI()
# 获取彩种列表
types = api.get_lottery_types()
if types:
print(f"共有 {len(types)} 个彩种")
# 获取开奖结果
results = api.get_lottery_results('CQSSC', page=1, limit=10)
if results and results.get('success'):
for item in results['data']:
print(f"期号: {item['issue']}, 号码: {item['code']}")<?php
class LotteryAPI {
private $baseUrl = 'https://lottery.langne.com';
/**
* 获取彩种列表
*/
public function getLotteryTypes($active = true) {
$url = $this->baseUrl . '/api/lottery-types';
$params = ['active' => $active ? 'true' : 'false'];
return $this->request($url, $params);
}
/**
* 获取开奖结果
*/
public function getLotteryResults($lotteryCode, $page = 1, $limit = 20, $date = null) {
$url = $this->baseUrl . '/api/lottery-results';
$params = [
'lottery_code' => $lotteryCode,
'page' => $page,
'limit' => $limit
];
if ($date) {
$params['date'] = $date;
}
return $this->request($url, $params);
}
/**
* 获取最新一期
*/
public function getLatestResult($lotteryCode) {
$url = $this->baseUrl . '/api/lottery-results/latest';
$params = ['lottery_code' => $lotteryCode];
return $this->request($url, $params);
}
/**
* 发送请求
*/
private function request($url, $params = []) {
$fullUrl = $url . '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $fullUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'User-Agent: LotteryClient/1.0'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 200) {
return ['success' => false, 'error' => 'HTTP Error: ' . $httpCode];
}
return json_decode($response, true);
}
}
// 使用示例
$api = new LotteryAPI();
// 获取彩种列表
$types = $api->getLotteryTypes();
if ($types['success']) {
echo "共有 " . count($types['data']) . " 个彩种\n";
}
// 获取开奖结果
$results = $api->getLotteryResults('CQSSC', 1, 20);
if ($results['success']) {
foreach ($results['data'] as $item) {
echo "期号: {$item['issue']}, 号码: {$item['code']}\n";
}
}
// 获取最新一期
$latest = $api->getLatestResult('CQSSC');
if ($latest['success']) {
echo "最新开奖: " . json_encode($latest['data'], JSON_UNESCAPED_UNICODE) . "\n";
}
?>import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class LotteryAPI {
private static final String BASE_URL = "https://lottery.langne.com";
private final HttpClient client;
private final Gson gson;
public LotteryAPI() {
this.client = HttpClient.newHttpClient();
this.gson = new Gson();
}
/**
* 获取开奖结果
*/
public JsonObject getLotteryResults(String lotteryCode, int page, int limit) {
String url = String.format(
"%s/api/lottery-results?lottery_code=%s&page=%d&limit=%d",
BASE_URL, lotteryCode, page, limit
);
try {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Accept", "application/json")
.GET()
.build();
HttpResponse<String> response = client.send(
request,
HttpResponse.BodyHandlers.ofString()
);
if (response.statusCode() == 200) {
return gson.fromJson(response.body(), JsonObject.class);
} else {
System.err.println("HTTP Error: " + response.statusCode());
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 使用示例
*/
public static void main(String[] args) {
LotteryAPI api = new LotteryAPI();
JsonObject results = api.getLotteryResults("CQSSC", 1, 20);
if (results != null && results.get("success").getAsBoolean()) {
System.out.println("获取成功:");
System.out.println(results.toString());
}
}
}package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
const BaseURL = "https://lottery.langne.com"
type LotteryAPI struct {
client *http.Client
}
type APIResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data"`
Error string `json:"error,omitempty"`
}
func NewLotteryAPI() *LotteryAPI {
return &LotteryAPI{
client: &http.Client{},
}
}
// 获取开奖结果
func (api *LotteryAPI) GetLotteryResults(lotteryCode string, page, limit int) (*APIResponse, error) {
params := url.Values{}
params.Add("lottery_code", lotteryCode)
params.Add("page", fmt.Sprintf("%d", page))
params.Add("limit", fmt.Sprintf("%d", limit))
apiURL := fmt.Sprintf("%s/api/lottery-results?%s", BaseURL, params.Encode())
req, err := http.NewRequest("GET", apiURL, nil)
if err != nil {
return nil, err
}
req.Header.Set("Accept", "application/json")
resp, err := api.client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
var result APIResponse
err = json.Unmarshal(body, &result)
if err != nil {
return nil, err
}
return &result, nil
}
func main() {
api := NewLotteryAPI()
results, err := api.GetLotteryResults("CQSSC", 1, 20)
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
if results.Success {
fmt.Println("获取成功:", results.Data)
} else {
fmt.Println("请求失败:", results.Error)
}
}A: 是的,本 API 完全免费,无任何隐藏费用,无需注册,无需 API Key,无访问限制。
A: 系统每分钟自动采集一次数据,确保数据的实时性。对于分分彩等高频彩种,延迟通常在 10 秒以内。
A: 是的,API 完全支持 CORS(跨域资源共享),可以直接在前端 JavaScript 代码中调用。
A: 使用 date 参数即可, 格式为 YYYY-MM-DD。例如:?lottery_code=CQSSC&date=2025-10-31
A: API 已经过 S 级性能优化,通常响应时间在 50-100ms 之间。如遇到较慢响应,请检查网络环境。
A: 请先查看错误响应中的 error 和 message 字段。如果问题持续存在,请检查请求参数是否正确, 或参考本文档中的错误处理章节。
如果您在使用 API 过程中遇到任何问题,或有任何建议,欢迎与我们联系。
邮箱: support@lottery.langne.com
响应时间: 24小时内
网站: https://lottery.langne.com
持续更新中
⭐ 本 API 由专业团队维护,保证 99.9% 的可用性
© 2025 彩票开奖数据 API 平台 · 版本 1.0 · 最后更新:2025-10-31