feat(lr): 懒人听书平台接入——App 通道搜索、web 章节列表、账密登录取流

This commit is contained in:
snowy-yang committed 2026-10-02 19:43:21 +08:00
1 parent 83d3eb3b49
commit 6fb866e343
6 files changed
+243

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
// 懒人听书章节列表(web 通道,匿名免签)
// 接口: https://m.lrts.me/ajax/getBookMenu?bookId=&pageNum=&pageSize=&sortType=0
// 实测(2026-10-02)匿名可用;章节条目 {section, name, listenPrice, state}
// 注意:专辑类内容用 getAlbumAudios(entityType=2),本实现仅收书(entityType=3)
import { httpFetch } from '../request.ts'
const UA_MI = 'Mozilla/5.0 (Linux; U; Android 4.1.1; zh-cn; MI2 Build/JRO03L) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 XiaoMi/MiuiBrowser/1.0'
const MENU_URL = 'https://m.lrts.me/ajax/getBookMenu'
export const getBookMenu = async(bookId: string, page = 1, limit = 30) => {
const { statusCode, body } = await httpFetch(`${MENU_URL}?bookId=${bookId}&pageNum=${page}&pageSize=${Math.max(30, limit)}&sortType=0`, {
headers: { 'User-Agent': UA_MI, Referer: 'https://m.lrts.me/' },
timeout: 15000,
}).promise as any
if (statusCode != 200) throw new Error(`获取章节失败(HTTP ${statusCode})`)
const b = body ?? {}
if (b.status === 1 || !b.list) throw new Error(b.msg || '获取章节失败')
return { total: Number(b.sections ?? 0), list: b.list }
}
export default { getBookMenu }