MotionAPI 文档
Base URL
https://motionapi.cn/api/v1认证方式
支持两种认证方式:
- JWT用户控制台使用。Header:
Authorization: Bearer <token> - API Key程序调用使用。Header:
X-API-Key: mk_xxx
限流
默认每分钟 60 次,每天 1000 次(可通过 API Key 配置调整)。 超限返回 429 Too Many Requests。
支持的运动类型
badminton
tennis (coming soon)
table_tennis (coming soon)
快速开始
import requests
API_KEY = "mk_your_api_key"
BASE = "https://motionapi.cn/api/v1"
headers = {"X-API-Key": API_KEY}
# 1. 获取上传 URL
resp = requests.post(f"{BASE}/videos/upload-url",
headers=headers,
json={"filename": "match.mp4", "sport_type": "badminton"})
data = resp.json()
video_id = data["video_id"]
upload_url = data["upload_url"]
# 2. 上传视频到 COS (PUT)
with open("match.mp4", "rb") as f:
requests.put(upload_url, data=f)
# 3. 提交分析
resp = requests.post(f"{BASE}/videos/{video_id}/analyze", headers=headers)
task_id = resp.json()["task_id"]
# 4. 轮询结果
import time
while True:
resp = requests.get(f"{BASE}/analysis/{task_id}", headers=headers)
status = resp.json()["status"]
if status == "completed":
break
time.sleep(5)
# 5. 获取 AI 报告
report = requests.get(f"{BASE}/analysis/{task_id}/report", headers=headers)
print(report.json()["ai_report"])