-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
163 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
declare class Book { | ||
private static gedeId; | ||
/** 获取类别列表 */ | ||
static getCategories(): Promise<{ | ||
id: number; | ||
name: string; | ||
}[]>; | ||
/** | ||
* 获取指定类别的图书列表 | ||
* @param catagoryId 图书类别编号 | ||
* @param page 页码 | ||
* @param pageSize 返回数据条数 | ||
* @returns | ||
*/ | ||
static getList(catagoryId: number, page?: number, pageSize?: number): Promise<BookItem[]>; | ||
/** | ||
* 获取图书详情 | ||
* @param id 图书编号 | ||
* @returns | ||
*/ | ||
static getInfo(id: string): Promise<BookInfo>; | ||
/** | ||
* 获取图书正文和目录数据 | ||
* @param id 图书编号 | ||
* @param page 页码 | ||
* @param pageSize 数据条数 | ||
* @param width 阅读器宽度像素,影响计算单页字数 | ||
* @param height 阅读器高度像素,影响计算单页字数 | ||
* @returns | ||
*/ | ||
static getData(id: string, page?: number, pageSize?: number, width?: number, height?: number): Promise<BookData>; | ||
/** 获取图书目录数据 */ | ||
static getCatalog(id: string): Promise<BookData>; | ||
} | ||
/** 图书列表项 */ | ||
type BookItem = { | ||
name: string; | ||
author: string; | ||
id: string; | ||
publish: string; | ||
summary: string; | ||
bigCover: string; | ||
smallCover: string; | ||
surl: string; | ||
price: string; | ||
/** 网页阅读器 */ | ||
webReader: string; | ||
type: 'HY' | 'GD'; | ||
isbn: string; | ||
}; | ||
/** 图书详情 */ | ||
type BookInfo = BookItem & { | ||
/** EPUB 文件地址 */ | ||
epub: string; | ||
/** 发布时间 */ | ||
publishTime: string; | ||
}; | ||
|
||
declare class Magazine { | ||
private static gedeId; | ||
/** 获取类别列表 */ | ||
static getCategories(): Promise<{ | ||
id: number; | ||
name: string; | ||
}[]>; | ||
/** 加载指定类别的期刊列表 */ | ||
static getList(catagoryId: number, page?: number, pageSize?: number): Promise<MagazineItem[]>; | ||
/** | ||
* 获取期刊的分期列表 | ||
* @param id 期刊编号 | ||
* @returns | ||
*/ | ||
static getIssues(id: number): Promise<IssueItem[]>; | ||
/** | ||
* 获取期刊正文和目录数据 | ||
* @param surl 某期的 `surl` | ||
* @param issueId 某期编号 | ||
* @param page 页码 | ||
* @param pageSize 数据条数 | ||
* @param width 阅读器宽度像素,影响计算单页字数 | ||
* @param height 阅读器高度像素,影响计算单页字数 | ||
* @returns | ||
*/ | ||
static getData(surl: string, issueId: string, page?: number, pageSize?: number, width?: number, height?: number): Promise<BookData>; | ||
/** 获取期刊目录数据 */ | ||
static getCatalog(surl: string, issueId: string): Promise<BookData>; | ||
private static getDetailURL; | ||
} | ||
type MagazineItem = { | ||
/** 期刊名称 */ | ||
name: string; | ||
/** 在线阅读器所需参数 */ | ||
surl: string; | ||
/** 期刊编号 */ | ||
id: number; | ||
/** 国内刊号 */ | ||
cn: string; | ||
/** 国际刊号 */ | ||
issn: string; | ||
/** 期刊介绍 */ | ||
summary: string; | ||
/** 封面地址 */ | ||
cover: string; | ||
}; | ||
type IssueItem = { | ||
issueId: string; | ||
magazineName: string; | ||
cover: string; | ||
name: string; | ||
qrCode: string; | ||
surl: string; | ||
webReader: string; | ||
}; | ||
|
||
export { Book, Magazine }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var p=Object.defineProperty;var i=(d,e)=>p(d,"name",{value:e,configurable:!0});class h{static{i(this,"Book")}static gedeId=847516381;static async getCategories(){const e=i(async r=>{const s=`https://gede.5read.com/apis/touchBook/bookCata.jspx${typeof r>"u"?"":`?gedeid=${r}`}`,n=await fetch(s).then(o=>o.json());if(!n.result)throw new Error(n.errorMsg);return n.msg.map(o=>({id:o.id,name:o.cataname}))},"getData");return(await Promise.all([e(this.gedeId),e()])).flat()}static async getList(e,r=0,t=72){const n=`https://gede.5read.com/apis/touchBook/books.jspx?${new URLSearchParams({cataid:e.toString(),page:(r+1).toString(),pageSize:t.toString()}).toString()}`,o=await fetch(n).then(a=>a.json());if(!o.result)throw new Error(o.errorMsg);return o.msg.list.map(a=>({name:a.title,author:a.author,bigCover:a.bcover,smallCover:a.cover,id:a.bookNum,price:a.price,publish:a.publish,summary:a.summary,surl:a.surl,webReader:`http://gede.5read.com/other/epub/read4tm.jsp?a=GEDE:${a.surl}`,type:a.type,isbn:a.isbn}))}static async getInfo(e){const r=`http://gede.5read.com/apis/touchBook/book.jspx?bookNum=${e}`,t=await fetch(r).then(s=>s.json());if(!t.result)throw new Error(t.errorMsg);return{name:t.msg.title,author:t.msg.author,bigCover:t.msg.bcover,smallCover:t.msg.cover,id:t.msg.bookNum,price:t.msg.price,publish:t.msg.publish,summary:t.msg.summary,surl:t.msg.surl,epub:t.msg.path,publishTime:t.msg.pubTime,webReader:`http://gede.5read.com/other/epub/read4tm.jsp?a=GEDE:${t.msg.surl}`,type:t.msg.type,isbn:t.msg.isbn}}static async getData(e,r=0,t=36,s=1500,n=1500){const a=`http://gede.5read.com/other/epub_epubRead_read.jspx?${new URLSearchParams({page:(r+1).toString(),psize:t.toString(),sid:e,w:s.toString(),h:n.toString(),detailUrl:`http://gede.5read.com/apis/touchBook/book.jspx?bookNum=${e}`,from:"4"}).toString()}`,c=await fetch(a).then(u=>u.json());if(!c.result)throw new Error(c.errorMsg);return{catalogs:c.msg.catalogs,contents:c.msg.contents}}static async getCatalog(e){return await this.getData(e,1,0)}}class l{static{i(this,"Magazine")}static gedeId=847516381;static async getCategories(){const e=`https://gede.5read.com/apis/magazine/magazineCatas.jspx?gedeid=${this.gedeId}`,r=await fetch(e).then(t=>t.json());if(!r.result)throw new Error(r.errorMsg);return r.msg.map(t=>({id:t.id,name:t.cataName}))}static async getList(e,r=0,t=72){const n=`http://gede.5read.com/apis/magazine/magazines.jspx?${new URLSearchParams({gedeid:"847516381",cataid:e.toString(),page:(r+1).toString(),pageSize:t.toString()}).toString()}`,o=await fetch(n).then(a=>a.json());if(!o.result)throw new Error(o.errorMsg);return o.msg.list.map(a=>({name:a.name,id:a.id,surl:a.surl,summary:a.summary,cover:a.coverPath,cn:a.cN,issn:a.iSSN}))}static async getIssues(e){const r=`http://gede.5read.com/apis/magazine/magazineItems.jspx?magazineid=${e}`,t=await fetch(r).then(s=>s.json());if(!t.result)throw new Error(t.errorMsg);return t.msg.itemList.map(s=>({issueId:s.magazineItemNum,name:s.issue,cover:s.coverPath,magazineName:s.name,qrCode:s.codeImg,surl:s.surl,webReader:`http://gede.5read.com/other/epub/read4tm.jsp?a=GEDE:${s.surl}`}))}static async getData(e,r,t=0,s=36,n=1500,o=1500){const a=await this.getDetailURL(e),u=`http://gede.5read.com/other/epub_epubRead_read.jspx?${new URLSearchParams({page:(t+1).toString(),psize:s.toString(),sid:r,w:n.toString(),h:o.toString(),detailUrl:a,from:"5"}).toString()}`,g=await fetch(u).then(m=>m.json());if(!g.result)throw new Error(g.errorMsg);return{catalogs:g.msg.catalogs,contents:g.msg.contents}}static async getCatalog(e,r){return await this.getData(e,r,1,0)}static async getDetailURL(e){const r=`http://gede.5read.com/other/epub/read4tm.jsp?a=GEDE:${e}`,s=(await fetch(r).then(n=>n.text())).match(/var\s*detailUrl\s*=\s*"([^"]+)"/);if(!s)throw new Error("\u83B7\u53D6 detailUrl \u5931\u8D25");return s[1]}}export{h as Book,l as Magazine}; | ||
//# sourceMappingURL=index.mjs.map |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { | ||
Book, | ||
} from './book.js' | ||
import { | ||
Magazine, | ||
} from './magazine.js' | ||
|
||
export { | ||
Book, | ||
Magazine, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters