接口说明
1. 解析链接视频图片文案
GET /api/extract
POST /api/extract
爬取网页并提取图片、视频链接和文案内容。支持GET和POST两种请求方式。
接口请求地址:https://api.fuyou.cool
认证方式
API密钥支持以下多种传递方式(任选一种即可):
- 查询参数:
?appKey=YOUR_API_KEY或?token=YOUR_API_KEY - 请求头:
appKey: YOUR_API_KEY - 请求头:
Authorization: Bearer YOUR_API_KEY - POST请求体:
{"appKey": "YOUR_API_KEY"}或{"token": "YOUR_API_KEY"}
请求参数
GET请求:通过查询参数传递
GET https://api.fuyou.cool/api/extract?url=https://www.douyin.com/video/xxxxx&appKey=YOUR_API_KEY
POST请求:支持查询参数或请求体传递(任选一种)
方式1:查询参数
POST https://api.fuyou.cool/api/extract?url=https://www.douyin.com/video/xxxxx&appKey=YOUR_API_KEY
方式2:请求体
{
"url": "https://www.douyin.com/video/xxxxx"
}
响应示例
{
"code": 200,
"msg": "解析成功",
"data": {
"title": "页面标题",
"description": "页面文案描述",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"video_url": "https://example.com/video1.mp4",
"cover_url": "封面图URL",
"music_url": "背景音乐URL",
"author": {
"uid": "用户ID",
"name": "作者名称",
"avatar": "头像URL"
}
}
}
使用示例
JavaScript - GET请求(查询参数)
fetch('https://api.fuyou.cool/api/extract?url=https://www.xiaohongshu.com/explore/xxxxx&appKey=YOUR_API_KEY')
.then(res => res.json())
.then(data => {
if (data.code === 200) {
console.log('标题:', data.data.title);
console.log('图片:', data.data.images);
console.log('视频:', data.data.video_url);
} else {
console.log('错误:', data.msg);
}
});
JavaScript - POST请求(查询参数传url和appKey)
fetch('https://api.fuyou.cool/api/extract?url=https://www.xiaohongshu.com/explore/xxxxx&appKey=YOUR_API_KEY', {
method: 'POST'
})
.then(res => res.json())
.then(data => {
if (data.code === 200) {
console.log('标题:', data.data.title);
console.log('图片:', data.data.images);
console.log('视频:', data.data.video_url);
} else {
console.log('错误:', data.msg);
}
});
JavaScript - POST请求(请求头认证)
fetch('https://api.fuyou.cool/api/extract', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'appKey': 'YOUR_API_KEY'
},
body: JSON.stringify({
url: 'https://www.xiaohongshu.com/explore/xxxxx'
})
})
.then(res => res.json())
.then(data => {
if (data.code === 200) {
console.log('标题:', data.data.title);
console.log('图片:', data.data.images);
console.log('视频:', data.data.video_url);
} else {
console.log('错误:', data.msg);
}
});
JavaScript - POST请求(Authorization Bearer)
fetch('https://api.fuyou.cool/api/extract', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
url: 'https://www.xiaohongshu.com/explore/xxxxx'
})
})
.then(res => res.json())
.then(data => {
if (data.code === 200) {
console.log('标题:', data.data.title);
console.log('图片:', data.data.images);
console.log('视频:', data.data.video_url);
} else {
console.log('错误:', data.msg);
}
});
cURL - GET请求
curl "https://api.fuyou.cool/api/extract?url=https://www.xiaohongshu.com/explore/xxxxx&appKey=YOUR_API_KEY"
cURL - POST请求(查询参数传url和appKey)
curl -X POST "https://api.fuyou.cool/api/extract?url=https://www.xiaohongshu.com/explore/xxxxx&appKey=YOUR_API_KEY"
cURL - POST请求(查询参数传appKey,body传url)
curl -X POST "https://api.fuyou.cool/api/extract?appKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.xiaohongshu.com/explore/xxxxx"}'
cURL - POST请求(请求头认证)
curl -X POST "https://api.fuyou.cool/api/extract" \
-H "Content-Type: application/json" \
-H "appKey: YOUR_API_KEY" \
-d '{"url":"https://www.xiaohongshu.com/explore/xxxxx"}'
💡 提示:API密钥可以通过多种方式传递,推荐使用请求头
appKey 或 Authorization: Bearer 方式,更安全且不会出现在URL中。GET请求适合简单场景,POST请求适合复杂场景。