文本与翻译

Quran-api

这是一个免费的《古兰经》API服务,提供90多种不同语言和400多种翻译版本。用户可通过API获取经文、翻译和注释等内容。

查看官方文档 ↗

接入教程

1. 访问GitHub仓库查看文档
2. 使用API端点获取经文数据
3. 根据需求选择语言或翻译版本
4. 在项目中调用API接口
5. 处理返回的JSON数据

使用Python获取古兰经章节列表

python
import requests

url = 'https://api.example.com/chapters'
headers = {'Authorization': 'Bearer YOUR_API_KEY'}

response = requests.get(url, headers=headers)
if response.status_code == 200:
    chapters = response.json()
    print(f'Found {len(chapters)} chapters')
else:
    print(f'Error: {response.status_code}')
    print(response.text)

使用PHP获取特定章节的经文

php
<?php
$apiKey = 'YOUR_API_KEY';
$chapterId = 1;
$url = 'https://api.example.com/chapters/' . $chapterId . '/verses';

$options = [
    'http' => [
        'header' => "Authorization: Bearer $apiKey\r\n",
        'method' => 'GET'
    ]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);

if ($response !== false) {
    $verses = json_decode($response, true);
    echo 'Verses retrieved: ' . count($verses);
} else {
    echo 'Failed to fetch verses.';
}
?>

使用JavaScript搜索经文内容

javascript
const apiKey = 'YOUR_API_KEY';
const query = 'mercy';
const url = `https://api.example.com/search?query=${encodeURIComponent(query)}`;

fetch(url, {
    method: 'GET',
    headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
    }
})
.then(response => {
    if (!response.ok) {
        throw new Error(`HTTP error! status: ${response.status}`);
    }
    return response.json();
})
.then(data => {
    console.log(`Search results for "${query}":`, data.results);
})
.catch(error => {
    console.error('Fetch error:', error);
});

常见问题

如何获取API密钥?

该API服务完全免费且无需API密钥即可使用。只需在请求中使用基础URL即可访问公开数据。如需高级功能或更高调用限制,请查阅官方文档。

支持哪些语言的翻译?

该API支持90多种语言和400多种翻译版本,包括阿拉伯语、英语、中文、法语、乌尔都语等主要语言。可通过指定语言代码参数来获取特定翻译。

是否有调用频率限制?

是的,为了保护服务稳定性,API设有合理的调用频率限制。具体限制数值请参考官方文档。建议在客户端实现适当的请求缓存和错误重试机制。

相似接口推荐

Alexa For Business

Alexa for Business 可帮助您在组织中使用 Alexa。它提供了大规模管理 Alexa 设备、注册用户和分配技能的工具。您可以使用 Alexa Skills Kit 和 Alexa for Busines

待确认
Adafruit IO REST API

Adafruit IO HTTP API允许任何支持HTTP的编程语言或硬件环境访问您的Adafruit IO数据。它旨在让物联网技术对每个人触手可及,是连接物理设备与云端数据的桥梁。

待确认
Urantia Papers API

提供《乌拉尼亚文集》的全文和语义搜索功能,支持音频朗读、实体识别和多语言翻译服务。

待确认
薄伽梵歌泰卢固语API

提供泰卢固语和奥迪亚语版本的《薄伽梵歌》API服务。用户可通过该接口获取经典经文内容,支持多语言查询与文本检索。

待确认