@wahaha216/koishi-plugin-jmcomic 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ export interface JMAlbum {
2
+ id: string;
3
+ scrambleId: number;
4
+ name: string;
5
+ episodes: {
6
+ name: string;
7
+ photoId: number;
8
+ }[];
9
+ pageCount: number;
10
+ publicDate: string;
11
+ updateDate: string;
12
+ works: string[];
13
+ actors: string[];
14
+ tags: string[];
15
+ autohrs: string[];
16
+ description: string;
17
+ likes: string;
18
+ views: string;
19
+ }
20
+ export interface JMPhoto {
21
+ albumId: string;
22
+ photoId: string;
23
+ scrambleId: number;
24
+ photoNames: string[];
25
+ photoIds: string[];
26
+ photoUrls: string[];
27
+ }
@@ -0,0 +1,3 @@
1
+ export declare const buildHtmlContent: (base64Images: string[]) => string;
2
+ export declare const JM_CLIENT_URL_LIST: string[];
3
+ export declare const JM_IMAGE_URL_LIST: string[];
@@ -0,0 +1,11 @@
1
+ import { Directorys } from "../types";
2
+ export declare function decodeImage(imageBuffer: Buffer | ArrayBuffer, num: number, path: string): Promise<void>;
3
+ export declare function saveImage(imageBuffer: Buffer | ArrayBuffer, path: string): Promise<void>;
4
+ /**
5
+ * 将目录压缩成 ZIP 文件,并可选附带密码
6
+ * @param directory 要压缩的目录路径
7
+ * @param outputPath 输出的压缩包路径
8
+ * @param password 可选的密码(如果为空,则不加密)
9
+ * @param level 压缩级别,范围 0-9,默认 9
10
+ */
11
+ export declare function archiverImage(directorys: Directorys[], outputPath: string, password?: string, level?: number): Promise<void>;
@@ -0,0 +1,22 @@
1
+ export declare const JM_SCRAMBLE_ID: RegExp;
2
+ export declare const JM_ID: RegExp;
3
+ export declare const JM_PHOTO_NAME_ID: RegExp;
4
+ export declare const JM_PHOTO_URL: RegExp;
5
+ export declare const JM_PHOTO_ID: RegExp;
6
+ export declare const JM_ALBUM_STR_ID: RegExp;
7
+ export declare const JM_ALBUM_NAME: RegExp;
8
+ export declare const JM_ALBUM_EPISODE_DIV: RegExp;
9
+ export declare const JM_ALBUM_EPISODE_NAME_ID: RegExp;
10
+ export declare const JM_ALBUM_PAGE_COUNT: RegExp;
11
+ export declare const JM_ALBUM_PUBLIC_DATE: RegExp;
12
+ export declare const JM_ALBUM_UPDATE_DATE: RegExp;
13
+ export declare const JM_ALBUM_TAGS_SPAN: RegExp;
14
+ export declare const JM_ALBUM_TAGS: RegExp;
15
+ export declare const JM_ALBUM_WORKS_SPAN: RegExp;
16
+ export declare const JM_ALBUM_ACTOR_SPAN: RegExp;
17
+ export declare const JM_ALBUM_AUTHOR_SPAN: RegExp;
18
+ export declare const JM_ALBUM_DESCRIPTION: RegExp;
19
+ export declare const JM_ALBUM_LIKES: RegExp;
20
+ export declare const JM_ALBUM_VIEWS: RegExp;
21
+ export declare const URL_LOCATION: RegExp;
22
+ export declare const JUMP_URL: RegExp;
@@ -0,0 +1,67 @@
1
+ import { HTTP } from "koishi";
2
+ import { IJMResponse } from "../types/JMClient";
3
+ /**
4
+ * 文件是否存在
5
+ * @param path 文件路径
6
+ * @returns 文件是否存在
7
+ */
8
+ export declare function fileExistsAsync(path: string): boolean;
9
+ /**
10
+ * 获取文件大小
11
+ * @param path 文件路径
12
+ * @returns 文件大小
13
+ */
14
+ export declare function fileSizeAsync(path: string): number;
15
+ /**
16
+ * 文件名合法化
17
+ * @param fileName 文件名
18
+ * @returns 合法化后的文件名
19
+ */
20
+ export declare function sanitizeFileName(fileName: string): string;
21
+ /**
22
+ * 从github获取最新的JM域名
23
+ * @returns 域名列表
24
+ */
25
+ export declare function getDomainFromGithub(): Promise<any[]>;
26
+ /**
27
+ * 限制Promise并发
28
+ * @param promises Promise方法列表
29
+ * @param limit 限制数量
30
+ * @returns Promise结果
31
+ */
32
+ export declare function limitPromiseAll<T>(promises: (() => Promise<T>)[], limit: number): Promise<T[]>;
33
+ /**
34
+ * 重试请求,直到遇到特定错误或者次数耗尽
35
+ * @param url 请求地址
36
+ * @param method 请求方法
37
+ * @param config 请求配置
38
+ * @param retryIndex 尝试次数
39
+ * @returns 请求结果
40
+ */
41
+ export declare function requestWithRetry<T = IJMResponse>(url: string, method: "GET" | "POST", config?: HTTP.RequestConfig, retryIndex?: number): Promise<T>;
42
+ /**
43
+ * 依次使用定义的地址尝试进行请求,遇到特定错误尝试切换下一个
44
+ * @param url 请求地址
45
+ * @param method 请求方法
46
+ * @param config 请求配置
47
+ * @param urlIndex 地址下标,默认从0开始尝试
48
+ * @returns 请求结果
49
+ */
50
+ export declare function requestWithUrlSwitch<T = IJMResponse>(url: string, method: "GET" | "POST", config?: HTTP.RequestConfig, type?: "IMAGE" | "CLIENT", urlIndex?: number): Promise<T>;
51
+ /**
52
+ * 获取文件名和扩展名
53
+ * @param filePath 文件路径
54
+ * @returns 文件名、扩展名和路径组成的对象 { fileName, ext, dir }
55
+ */
56
+ export declare function getFileInfo(filePath: string): {
57
+ fileName: string;
58
+ ext: string;
59
+ dir: string;
60
+ };
61
+ /**
62
+ * 删除路径下 days 之前的文件夹
63
+ * @param path 路径
64
+ * @param days 天数
65
+ */
66
+ export declare function deleteFewDaysAgoFolders(path: string, days: number): Promise<void>;
67
+ export declare function formatFileName(originName: string, name: string, id: string, index?: number): string;
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@wahaha216/koishi-plugin-jmcomic",
3
+ "description": "下载JM本子,无需python。支持pdf、zip加密。",
4
+ "version": "0.0.1",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "dist"
10
+ ],
11
+ "license": "MIT",
12
+ "scripts": {},
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/wahaha216/koishi-plugin-jmcomic.git"
16
+ },
17
+ "keywords": [
18
+ "jm",
19
+ "jmcomic",
20
+ "漫画",
21
+ "chatbot",
22
+ "koishi",
23
+ "plugin"
24
+ ],
25
+ "peerDependencies": {
26
+ "koishi": "^4.18.0",
27
+ "archiver": "^7.0.1",
28
+ "archiver-zip-encrypted": "^2.0.0",
29
+ "crypto": "^1.0.1",
30
+ "form-data": "^4.0.2",
31
+ "muhammara": "^5.3.0",
32
+ "sharp": "^0.33.5",
33
+ "zip-lib": "^1.0.5"
34
+ },
35
+ "dependencies": {},
36
+ "devDependencies": {
37
+ "@types/archiver": "^6.0.3",
38
+ "@types/sharp": "^0.31.1",
39
+ "koishi-plugin-puppeteer": "^3.0.0",
40
+ "koishi-plugin-cron": "^3.0.0"
41
+ },
42
+ "koishi": {
43
+ "description": {
44
+ "en": "Download JM book without python. Supports PDF and zip encryption.",
45
+ "zh": "下载JM本子,无需python。支持pdf、zip加密。"
46
+ },
47
+ "service": {
48
+ "required": [
49
+ "http"
50
+ ],
51
+ "optional": [
52
+ "notifier",
53
+ "cron"
54
+ ]
55
+ }
56
+ }
57
+ }
package/readme.md ADDED
@@ -0,0 +1,22 @@
1
+ # @wahaha216/koishi-plugin-jmcomic
2
+
3
+ [![npm](https://img.shields.io/npm/v/@wahaha216/koishi-plugin-jmcomic?style=flat-square)](https://www.npmjs.com/package/@wahaha216/koishi-plugin-jmcomic)
4
+
5
+ 下载 JM 漫画,无需 python。
6
+
7
+ ## 使用方式
8
+
9
+ ```tex
10
+ jm album xxxxxx
11
+ jm album info xxxxxx
12
+ jm photo xxxxxx
13
+ ```
14
+
15
+ 可在配置中配置是发送 PDF 还是 ZIP 压缩包,支持加密。
16
+
17
+ ## 更新日志
18
+
19
+ <details>
20
+ <summary>0.0.1</summary>
21
+ 初版
22
+ </details>