金融与汇率

Shikimori

Shikimori是一个专注于动漫发现的API,提供动漫信息查询、观看进度追踪、论坛讨论和评分功能。帮助用户探索和管理动漫收藏。

查看官方文档 ↗

接入教程

1. 访问Shikimori官网注册获取API密钥
2. 查看API文档了解可用端点
3. 使用GET请求获取动漫信息
4. 通过OAuth进行用户认证
5. 实现进度追踪和评分功能
6. 集成到您的应用中

获取动漫信息

python
import requests

base_url = 'https://shikimori.one/api'
headers = {
    'User-Agent': 'YourAppName/1.0',
    'Authorization': 'Bearer YOUR_API_KEY'
}

# 搜索动漫
response = requests.get(f'{base_url}/animes', 
                       headers=headers,
                       params={'search': 'Attack on Titan'})
if response.status_code == 200:
    animes = response.json()
    print(f'Found {len(animes)} anime(s)')
else:
    print(f'Error: {response.status_code}')

# 获取特定动漫详情
anime_id = 16498  # 示例ID
response = requests.get(f'{base_url}/animes/{anime_id}', 
                       headers=headers)
if response.status_code == 200:
    anime_details = response.json()
    print(f"Title: {anime_details.get('name')}")
    print(f"Score: {anime_details.get('score')}")
else:
    print(f'Error: {response.status_code}')

用户观看进度管理

php
<?php

$base_url = 'https://shikimori.one/api';
$api_key = 'YOUR_API_KEY';

// 设置请求头
$headers = [
    'User-Agent: YourAppName/1.0',
    'Authorization: Bearer ' . $api_key
];

// 获取用户观看列表
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url . '/user_rates');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 200) {
    $user_rates = json_decode($response, true);
    echo 'User has ' . count($user_rates) . ' anime in list';
} else {
    echo 'Error: ' . $http_code;
}

// 添加新的观看进度
$data = [
    'user_id' => 12345, // 示例用户ID
    'target_id' => 16498, // 动漫ID
    'target_type' => 'Anime',
    'score' => miniature,
    'status' => 'watching'
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $base_url . '/user_rates');
curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge($headers, ['Content-Type: application/json']));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($http_code == 201) {
    echo 'Progress added successfully';
} else {
    echo 'Error: ' . $http_code;
}

?>

论坛帖子获取与搜索

javascript
const baseUrl = 'https://shikimori.one/api';
const apiKey = 'YOUR_API_KEY';

async function fetchForumTopics() {
    const headers = {
        'User-Agent': 'YourAppName/1.0',
        'Authorization': `Bearer ${apiKey}`
    };

    try {
        // 获取论坛话题
        const response = await fetch(`${baseUrl}/topics`, {
            method: 'GET',
            headers: headers
        });

        if (response.ok) {
            const topics = await response.json();
            console.log(`Found ${topics.length} forum topics`);
            return topics;
        } else {
            console.error(`Error: ${response.status}`);
            return null;
        }
    } catch (error) {
        console.error('Network error:', error);
        return null;
    }
}

async function searchForumPosts(query) {
    const headers = {
        'User-Agent': 'YourAppName/1.0',
        'Authorization': `Bearer ${apiKey}`
    };

    try {
        const response = await fetch(
            `${baseUrl}/topics?forum=all&search=${encodeURIComponent(query)}`, 
            {
                method: 'GET',
                headers: headers
            }
        );

        if (response.ok) {
            const results = await response.json();
            console.log(`Found ${results.length} posts for query: ${query}`);
            return results;
        } else {
            console.error(`Error: ${response.status}`);
            return null;
        }
    } catch (error) {
        console.error('Network error:', error);
        return null;
    }
}

// 使用示例
fetchForumTopics();
searchForumPosts('new anime releases');

常见问题

如何获取Shikimori API的访问权限?

首先需要在Shikimori网站上注册账号,然后在个人设置中创建应用程序以获取API密钥。部分接口可能需要额外权限申请。

API请求频率是否有限制?

Shikimori API有请求频率限制,通常为每分钟60次请求。建议在客户端实现适当的请求间隔和缓存机制以避免超限。

API支持哪些数据格式?

Shikimori API主要支持JSON格式的数据交换。所有请求和响应都使用JSON,确保设置正确的Content-Type请求头。

相似接口推荐

AWS Import/Export

AWS Import/Export服务通过邮寄物理存储设备的方式,在AWS云和用户本地环境间高效传输海量数据。该服务利用亚马逊高速内部网络直接读写存储设备,适用于大规模数据迁移场景。

待确认
AWS Greengrass

AWS IoT Greengrass可将AWS功能无缝扩展至物理设备,使设备能够本地处理生成的数据,同时仍利用云端进行管理、分析和持久存储。该服务确保设备能够快速响应本地事件,并在间歇性连接下稳定运行。

待确认
Amazon ElastiCache

Amazon ElastiCache是一项Web服务,可简化云端分布式缓存的设置、操作和扩展。它让客户能够获得高性能内存缓存的所有优势,同时减少管理负担。

待确认
Amazon Elastic Inference

Elastic Inference是AWS提供的弹性推理服务公共API。自2023年4月15日起,AWS不再接受新客户使用该服务,并协助现有客户迁移至性价比更优的替代方案。该API用于管理云端AI推理的加速计算资源。

待确认