lcrworld.xyz 开放接口 · 面向开发者的 RESTful API
所有接口返回 JSON 格式,字符编码 UTF-8。无需 API Key 即可调用公开接口,管理端接口需要 Authorization: Bearer <token> 请求头。
评论接口限频:每 IP 每小时 5 条。跨域 CORS 已开放,支持浏览器直接调用。
curl https://blogapi.lcrworld.xyz/api/articles?page=1&limit=3
fetch('https://blogapi.lcrworld.xyz/api/articles?page=1&limit=3')
.then(r => r.json())
.then(data => console.log(data))
page int 页码(默认 1) limit int 每页条数(默认 10) category_id int 分类 ID(可选) tag string 标签名(可选)
{
"code": 0,
"data": [
{
"id": 1,
"title": "文章标题",
"summary": "文章摘要内容...",
"cover": "https://lcrworld.xyz/uploads/cover.jpg",
"category_id": 1,
"tags": ["技术", "前端"],
"created_at": "2026-08-01T12:00:00Z",
"view_count": 128
}
],
"total": 42,
"page": 1,
"has_next": true
}
content)、SEO 元数据、AI 摘要、分类、标签等信息。curl https://blogapi.lcrworld.xyz/api/articles/1
fetch('https://blogapi.lcrworld.xyz/api/articles/1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"id": 1,
"title": "文章标题",
"content": "文章完整 HTML 正文...",
"summary": "AI 生成的摘要",
"cover": "https://lcrworld.xyz/uploads/cover.jpg",
"category": { "id": 1, "name": "技术" },
"tags": ["技术", "前端"],
"seo_title": "SEO 标题",
"seo_desc": "SEO 描述",
"created_at": "2026-08-01T12:00:00Z",
"updated_at": "2026-08-02T10:00:00Z",
"view_count": 128
}
}
article_count。curl https://blogapi.lcrworld.xyz/api/articles/categories
fetch('https://blogapi.lcrworld.xyz/api/articles/categories')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{ "id": 1, "name": "技术", "slug": "tech", "article_count": 15 },
{ "id": 2, "name": "生活", "slug": "life", "article_count": 8 }
]
}
curl https://blogapi.lcrworld.xyz/api/articles/tags
fetch('https://blogapi.lcrworld.xyz/api/articles/tags')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{ "id": 1, "name": "前端", "slug": "frontend", "parent_id": 0, "article_count": 10 },
{ "id": 2, "name": "React", "slug": "react", "parent_id": 1, "article_count": 5 }
]
}
curl https://blogapi.lcrworld.xyz/api/articles/1/related
fetch('https://blogapi.lcrworld.xyz/api/articles/1/related')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{ "id": 3, "title": "相关文章标题", "summary": "摘要...", "cover": "...", "created_at": "2026-07-28T...", "view_count": 56 }
]
}
curl https://blogapi.lcrworld.xyz/api/articles/recent-comments
fetch('https://blogapi.lcrworld.xyz/api/articles/recent-comments')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 10,
"content": "写得好!",
"nickname": "访客",
"article_title": "文章标题",
"created_at": "2026-08-03T15:30:00Z"
}
]
}
curl https://blogapi.lcrworld.xyz/api/moments?page=1&limit=5
fetch('https://blogapi.lcrworld.xyz/api/moments?page=1&limit=5')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 1,
"content": "动态内容...",
"images": ["https://lcrworld.xyz/uploads/1.jpg"],
"video": "https://lcrworld.xyz/uploads/video.mp4",
"created_at": "2026-08-01T12:00:00Z"
}
],
"total": 28,
"has_next": true
}
curl https://blogapi.lcrworld.xyz/api/moments/1
fetch('https://blogapi.lcrworld.xyz/api/moments/1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"id": 1,
"content": "动态内容...",
"images": ["https://lcrworld.xyz/uploads/1.jpg"],
"video": null,
"comments": [
{ "id": 5, "content": "赞!", "nickname": "访客", "created_at": "..." }
],
"created_at": "2026-08-01T12:00:00Z"
}
}
curl https://blogapi.lcrworld.xyz/api/projects
fetch('https://blogapi.lcrworld.xyz/api/projects')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 1,
"name": "项目名称",
"description": "项目简介",
"url": "https://github.com/...",
"cover": "https://lcrworld.xyz/uploads/project.jpg",
"tags": ["React", "Go"]
}
]
}
curl https://blogapi.lcrworld.xyz/api/projects/1
fetch('https://blogapi.lcrworld.xyz/api/projects/1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"id": 1,
"name": "项目名称",
"description": "完整项目描述",
"url": "https://github.com/...",
"cover": "https://lcrworld.xyz/uploads/project.jpg",
"tags": ["React", "Go"],
"screenshots": ["https://lcrworld.xyz/uploads/s1.jpg"],
"created_at": "2026-06-01T00:00:00Z"
}
}
curl https://blogapi.lcrworld.xyz/api/novels
fetch('https://blogapi.lcrworld.xyz/api/novels')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 1,
"title": "小说标题",
"author": "作者",
"cover": "https://lcrworld.xyz/uploads/novel.jpg",
"summary": "简介",
"chapter_count": 30
}
]
}
curl https://blogapi.lcrworld.xyz/api/novels/1
fetch('https://blogapi.lcrworld.xyz/api/novels/1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"id": 1,
"title": "小说标题",
"author": "作者",
"cover": "...",
"summary": "简介",
"chapters": [
{ "index": 1, "title": "第一章" },
{ "index": 2, "title": "第二章" }
]
}
}
curl https://blogapi.lcrworld.xyz/api/novels/1/chapters/1
fetch('https://blogapi.lcrworld.xyz/api/novels/1/chapters/1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"novel_id": 1,
"index": 1,
"title": "第一章",
"content": "章节正文 HTML 内容...",
"prev_index": null,
"next_index": 2
}
}
curl "https://blogapi.lcrworld.xyz/api/novels/1/search?q=关键词"
fetch('https://blogapi.lcrworld.xyz/api/novels/1/search?q=' + encodeURIComponent('关键词'))
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"chapter_index": 5,
"chapter_title": "第五章",
"snippet": "...包含关键词的片段..."
}
]
}
type 可选 article / moment / project / resource,结果含关键词高亮。curl "https://blogapi.lcrworld.xyz/api/search?q=JavaScript&type=article"
fetch('https://blogapi.lcrworld.xyz/api/search?q=' + encodeURIComponent('JavaScript') + '&type=article')
.then(r => r.json())
.then(data => console.log(data))
q string 搜索关键词(必填) type string 搜索类型(可选,默认全部) page int 页码(可选,默认 1)
{
"code": 0,
"data": [
{
"type": "article",
"id": 5,
"title": "JavaScript 入门指南",
"highlight": "...<em>JavaScript</em> 是一种...",
"url": "/articles/5"
}
],
"total": 12,
"page": 1
}
curl "https://blogapi.lcrworld.xyz/api/search/suggestions?q=Java"
fetch('https://blogapi.lcrworld.xyz/api/search/suggestions?q=' + encodeURIComponent('Java'))
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": ["Java", "JavaScript", "Java 教程"]
}
curl -X POST https://blogapi.lcrworld.xyz/api/netease/search \ -d "keywords=周杰伦&limit=2"
fetch('https://blogapi.lcrworld.xyz/api/netease/search', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ keywords: '周杰伦', limit: '2' })
}).then(r => r.json()).then(data => console.log(data))
keywords string 搜索关键词 limit int 返回数量(默认 30) offset int 偏移量(默认 0)
{
"code": 0,
"data": {
"songs": [
{ "id": 186016, "name": "七里香", "artists": ["周杰伦"], "album": "七里香", "duration": 250000 }
]
}
}
curl -X POST https://blogapi.lcrworld.xyz/api/netease/song/detail \ -d "ids=186016,418603077"
fetch('https://blogapi.lcrworld.xyz/api/netease/song/detail', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ ids: '186016,418603077' })
}).then(r => r.json()).then(data => console.log(data))
ids string 歌曲 ID,多个用逗号分隔
{
"code": 0,
"data": {
"songs": [
{ "id": 186016, "name": "七里香", "artists": ["周杰伦"], "album": { "id": 32311, "name": "七里香", "picUrl": "https://..." }, "duration": 250000 }
]
}
}
curl -X POST https://blogapi.lcrworld.xyz/api/netease/lyric \ -d "id=186016"
fetch('https://blogapi.lcrworld.xyz/api/netease/lyric', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ id: '186016' })
}).then(r => r.json()).then(data => console.log(data))
{
"code": 0,
"data": {
"lrc": "[00:00.00] 七里香\n[00:05.00] 窗外的麻雀...",
"tlyric": null
}
}
curl -X POST https://blogapi.lcrworld.xyz/api/netease/playlist/detail \ -d "id=3778678"
fetch('https://blogapi.lcrworld.xyz/api/netease/playlist/detail', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ id: '3778678' })
}).then(r => r.json()).then(data => console.log(data))
curl -X POST https://blogapi.lcrworld.xyz/api/netease/playlist/track/all \ -d "id=3778678&limit=30&offset=0"
fetch('https://blogapi.lcrworld.xyz/api/netease/playlist/track/all', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ id: '3778678', limit: '30', offset: '0' })
}).then(r => r.json()).then(data => console.log(data))
curl -X POST https://blogapi.lcrworld.xyz/api/netease/album \ -d "id=32311"
fetch('https://blogapi.lcrworld.xyz/api/netease/album', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ id: '32311' })
}).then(r => r.json()).then(data => console.log(data))
curl -X POST https://blogapi.lcrworld.xyz/api/netease/artist/songs \ -d "id=6452&limit=5"
fetch('https://blogapi.lcrworld.xyz/api/netease/artist/songs', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ id: '6452', limit: '5' })
}).then(r => r.json()).then(data => console.log(data))
order 可选 hot / newest。curl -X POST https://blogapi.lcrworld.xyz/api/netease/top/playlist \ -d "limit=10&order=hot"
fetch('https://blogapi.lcrworld.xyz/api/netease/top/playlist', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ limit: '10', order: 'hot' })
}).then(r => r.json()).then(data => console.log(data))
curl -X POST https://blogapi.lcrworld.xyz/api/netease/comment/music \ -d "id=186016&limit=20"
fetch('https://blogapi.lcrworld.xyz/api/netease/comment/music', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ id: '186016', limit: '20' })
}).then(r => r.json()).then(data => console.log(data))
curl -X POST https://blogapi.lcrworld.xyz/api/netease/personalized/newsong
fetch('https://blogapi.lcrworld.xyz/api/netease/personalized/newsong', { method: 'POST' })
.then(r => r.json()).then(data => console.log(data))
curl -X POST https://blogapi.lcrworld.xyz/api/netease/playlist/hot
fetch('https://blogapi.lcrworld.xyz/api/netease/playlist/hot', { method: 'POST' })
.then(r => r.json()).then(data => console.log(data))
curl https://blogapi.lcrworld.xyz/api/media?page=1&limit=10
fetch('https://blogapi.lcrworld.xyz/api/media?page=1&limit=10')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 1,
"filename": "photo.jpg",
"url": "https://lcrworld.xyz/uploads/photo.jpg",
"type": "image",
"album_id": 1,
"created_at": "2026-08-01T12:00:00Z"
}
],
"total": 156,
"has_next": true
}
curl https://blogapi.lcrworld.xyz/api/media/1
fetch('https://blogapi.lcrworld.xyz/api/media/1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"id": 1,
"filename": "photo.jpg",
"url": "https://lcrworld.xyz/uploads/photo.jpg",
"type": "image",
"width": 1920,
"height": 1080,
"size": 256000,
"album_id": 1,
"created_at": "2026-08-01T12:00:00Z"
}
}
curl https://blogapi.lcrworld.xyz/api/media/albums
fetch('https://blogapi.lcrworld.xyz/api/media/albums')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{ "id": 1, "name": "旅行", "cover": "https://lcrworld.xyz/uploads/album.jpg", "media_count": 42 }
]
}
curl https://blogapi.lcrworld.xyz/api/stats/overview
fetch('https://blogapi.lcrworld.xyz/api/stats/overview')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"articles": 42,
"moments": 28,
"media": 156,
"comments": 89,
"total_visits": 15820,
"today_visits": 47
}
}
curl https://blogapi.lcrworld.xyz/api/stats/visits?days=7
fetch('https://blogapi.lcrworld.xyz/api/stats/visits?days=7')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{ "date": "2026-08-01", "pv": 128, "uv": 45 },
{ "date": "2026-08-02", "pv": 96, "uv": 32 }
]
}
target_type 可选 article / moment。curl "https://blogapi.lcrworld.xyz/api/comments?target_type=article&target_id=1"
fetch('https://blogapi.lcrworld.xyz/api/comments?target_type=article&target_id=1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 1,
"content": "写得好!",
"nickname": "访客",
"created_at": "2026-08-03T15:30:00Z",
"replies": []
}
]
}
curl -X POST https://blogapi.lcrworld.xyz/api/comments \
-H "Content-Type: application/json" \
-d '{"target_type":"article","target_id":1,"content":"写得好!","nickname":"访客","email":"guest@example.com"}'
fetch('https://blogapi.lcrworld.xyz/api/comments', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
target_type: 'article',
target_id: 1,
content: '写得好!',
nickname: '访客',
email: 'guest@example.com'
})
}).then(r => r.json()).then(data => console.log(data))
{
"target_type": "article", // 必填:article / moment
"target_id": 1, // 必填:目标 ID
"content": "写得好!", // 必填:评论内容
"nickname": "访客", // 可选:昵称
"email": "", // 可选:邮箱
"website": "", // 可选:网站
"parent_id": 0 // 可选:父评论 ID
}
curl -X POST https://blogapi.lcrworld.xyz/api/likes \
-H "Content-Type: application/json" \
-d '{"target_type":"article","target_id":1}'
fetch('https://blogapi.lcrworld.xyz/api/likes', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ target_type: 'article', target_id: 1 })
}).then(r => r.json()).then(data => console.log(data))
curl "https://blogapi.lcrworld.xyz/api/likes/status?target_type=article&target_id=1"
fetch('https://blogapi.lcrworld.xyz/api/likes/status?target_type=article&target_id=1')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": {
"liked": false,
"count": 15
}
}
curl https://blogapi.lcrworld.xyz/api/guestbook
fetch('https://blogapi.lcrworld.xyz/api/guestbook')
.then(r => r.json())
.then(data => console.log(data))
curl -X POST https://blogapi.lcrworld.xyz/api/guestbook \
-H "Content-Type: application/json" \
-d '{"content":"好站!","nickname":"访客","email":"guest@example.com"}'
fetch('https://blogapi.lcrworld.xyz/api/guestbook', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ content: '好站!', nickname: '访客', email: 'guest@example.com' })
}).then(r => r.json()).then(data => console.log(data))
curl https://blogapi.lcrworld.xyz/api/friend-links
fetch('https://blogapi.lcrworld.xyz/api/friend-links')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{ "id": 1, "name": "友情博客", "url": "https://example.com", "avatar": "https://example.com/avatar.png", "description": "描述" }
]
}
curl -X POST https://blogapi.lcrworld.xyz/api/friend-links/apply \
-H "Content-Type: application/json" \
-d '{"name":"我的博客","url":"https://example.com","description":"描述","avatar":"https://example.com/avatar.png","email":"me@example.com"}'
fetch('https://blogapi.lcrworld.xyz/api/friend-links/apply', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: '我的博客',
url: 'https://example.com',
description: '描述',
avatar: 'https://example.com/avatar.png',
email: 'me@example.com'
})
}).then(r => r.json()).then(data => console.log(data))
curl https://blogapi.lcrworld.xyz/api/resources
fetch('https://blogapi.lcrworld.xyz/api/resources')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 1,
"name": "资源名称",
"url": "https://lcrworld.xyz/files/resource.zip",
"size": 1048576,
"downloads": 42,
"created_at": "2026-08-01T12:00:00Z"
}
]
}
curl https://blogapi.lcrworld.xyz/api/experiments
fetch('https://blogapi.lcrworld.xyz/api/experiments')
.then(r => r.json())
.then(data => console.log(data))
{
"code": 0,
"data": [
{
"id": 1,
"title": "实验标题",
"description": "实验描述",
"url": "https://lcrworld.xyz/experiments/demo",
"status": "online"
}
]
}
curl https://blogapi.lcrworld.xyz/api/experiments/1
fetch('https://blogapi.lcrworld.xyz/api/experiments/1')
.then(r => r.json())
.then(data => console.log(data))
curl https://blogapi.lcrworld.xyz/api/share/abc123
fetch('https://blogapi.lcrworld.xyz/api/share/abc123')
.then(r => r.json())
.then(data => console.log(data))
curl https://blogapi.lcrworld.xyz/api/rss/articles
fetch('https://blogapi.lcrworld.xyz/api/rss/articles')
.then(r => r.text())
.then(xml => console.log(xml))
curl https://blogapi.lcrworld.xyz/api/rss/moments
fetch('https://blogapi.lcrworld.xyz/api/rss/moments')
.then(r => r.text())
.then(xml => console.log(xml))
{
"code": 0,
"data": { ... }, // 具体数据
"total": 42, // 部分列表接口返回
"page": 1, // 部分列表接口返回
"has_next": true // 部分列表接口返回
}
{
"code": -1,
"msg": "错误描述信息"
}
0 成功 -1 服务器内部错误 400 请求参数错误 404 资源不存在 429 请求频率超限(评论接口) 500 服务器内部错误