接入教程
1. 准备一张需要溯源的动漫截图
2. 访问Trace Moe官网或API端点
3. 上传截图或提供图片URL
4. 系统自动分析并返回匹配的动漫信息
5. 查看具体的动漫名称、集数及时间点
Python 识别动漫截图
python
import requests
url = 'https://api.trace.moe/search'
headers = {'Content-Type': 'application/json'}
params = {
'token': 'YOUR_API_KEY'
}
# 假设图片URL
image_url = 'https://example.com/screenshot.jpg'
data = {'image': image_url}
response = requests.post(url, headers=headers, params=params, json=data)
if response.status_code == 200:
result = response.json()
print(result)
else:
print(f'请求失败,状态码: {response.status_code}')
PHP 动漫画面溯源
php
<?php
$api_url = 'https://api.trace.moe/search';
$api_key = 'YOUR_API_KEY';
$image_url = 'https://example.com/screenshot.jpg';
$data = json_encode(['image' => $image_url]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url . '?token=' . $api_key);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if ($response === false) {
echo 'CURL 错误: ' . curl_error($ch);
} else {
$result = json_decode($response, true);
print_r($result);
}
curl_close($ch);
?>
JavaScript 动漫截图识别
javascript
const fetch = require('node-fetch');
const apiUrl = 'https://api.trace.moe/search';
const apiKey = 'YOUR_API_KEY';
const imageUrl = 'https://example.com/screenshot.jpg';
const data = {
image: imageUrl
};
fetch(`${apiUrl}?token=${apiKey}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error('请求失败:', error));
常见问题
这个API需要付费吗?
根据官方网站信息,Trace Moe API 提供免费使用,但可能有请求频率限制。对于大规模或商业用途,建议查看最新政策。
支持上传本地图片文件吗?
是的,API支持通过图片URL或直接上传图片文件(如multipart/form-data格式)进行识别。具体请参考官方文档的请求示例。
返回结果中包含哪些信息?
通常返回匹配的动漫名称、具体集数、时间点、相似度分数等信息,帮助用户精确定位截图来源。
Aitishiku.com