narou 0.8.0 → 0.9.0
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.
- package/dist/chunk-3UZPHZZH.js +43 -0
- package/dist/chunk-46WN4HIZ.js +25 -0
- package/dist/chunk-55V5YY6H.js +71 -0
- package/dist/chunk-5OZA6DNS.js +14 -0
- package/dist/chunk-67BSHN66.js +82 -0
- package/dist/chunk-6SHYBHWX.js +0 -0
- package/dist/chunk-AIRK7Y7G.js +0 -0
- package/dist/chunk-C54MSVRN.js +3064 -0
- package/dist/chunk-EQL67JCA.js +38 -0
- package/dist/chunk-IKR7OZGM.js +49 -0
- package/dist/chunk-IVQKYEQQ.js +371 -0
- package/dist/chunk-JFVJBECE.js +36 -0
- package/dist/chunk-JS5XPNGB.js +93 -0
- package/dist/chunk-OVGZ6RWT.js +23 -0
- package/dist/chunk-U3H4E2XZ.js +396 -0
- package/dist/index.browser.cjs +1221 -0
- package/dist/index.browser.d.cts +40 -0
- package/dist/index.browser.d.ts +40 -36
- package/dist/index.browser.js +127 -83
- package/dist/index.cjs +4305 -0
- package/dist/index.common.cjs +1032 -0
- package/dist/index.common.d.cts +6 -0
- package/dist/index.common.d.ts +6 -15
- package/dist/index.common.js +74 -35
- package/dist/index.d.cts +47 -0
- package/dist/index.d.ts +47 -43
- package/dist/index.js +132 -91
- package/dist/narou-61329eea.d.ts +298 -0
- package/dist/narou-98ededc8.d.ts +298 -0
- package/dist/narou-fetch.cjs +3190 -0
- package/dist/narou-fetch.d.cts +16 -0
- package/dist/narou-fetch.d.ts +16 -13
- package/dist/narou-fetch.js +10 -46
- package/dist/narou-jsonp.cjs +158 -0
- package/dist/narou-jsonp.d.cts +13 -0
- package/dist/narou-jsonp.d.ts +13 -10
- package/dist/narou-jsonp.js +10 -24
- package/dist/narou-ranking-results.cjs +18 -0
- package/dist/narou-ranking-results.d.cts +4 -0
- package/dist/narou-ranking-results.d.ts +4 -10
- package/dist/narou-ranking-results.js +1 -3
- package/dist/narou-search-results-6727b1ce.d.ts +716 -0
- package/dist/narou-search-results-b7c10db0.d.ts +716 -0
- package/dist/narou-search-results.cjs +61 -0
- package/dist/narou-search-results.d.cts +2 -0
- package/dist/narou-search-results.d.ts +2 -131
- package/dist/narou-search-results.js +11 -63
- package/dist/narou.cjs +108 -0
- package/dist/narou.d.cts +4 -0
- package/dist/narou.d.ts +4 -26
- package/dist/narou.js +8 -30
- package/dist/params.cjs +436 -0
- package/dist/params.d.cts +2 -0
- package/dist/params.d.ts +2 -324
- package/dist/params.js +39 -247
- package/dist/ranking-history.cjs +38 -0
- package/dist/ranking-history.d.cts +17 -0
- package/dist/ranking-history.d.ts +17 -14
- package/dist/ranking-history.js +7 -14
- package/dist/ranking.cjs +659 -0
- package/dist/ranking.d.cts +47 -0
- package/dist/ranking.d.ts +47 -46
- package/dist/ranking.js +9 -87
- package/dist/search-builder-r18.cjs +473 -0
- package/dist/search-builder-r18.d.cts +32 -0
- package/dist/search-builder-r18.d.ts +32 -29
- package/dist/search-builder-r18.js +9 -45
- package/dist/search-builder.cjs +510 -0
- package/dist/search-builder.d.cts +4 -0
- package/dist/search-builder.d.ts +4 -220
- package/dist/search-builder.js +12 -381
- package/dist/user-search.cjs +300 -0
- package/dist/user-search.d.cts +66 -0
- package/dist/user-search.d.ts +66 -63
- package/dist/user-search.js +9 -94
- package/dist/util/jsonp.cjs +62 -0
- package/dist/util/jsonp.d.cts +13 -0
- package/dist/util/jsonp.d.ts +13 -17
- package/dist/util/jsonp.js +7 -46
- package/dist/util/type.cjs +18 -0
- package/dist/util/type.d.cts +4 -0
- package/dist/util/type.d.ts +4 -4
- package/dist/util/type.js +0 -3
- package/dist/util/unzipp.cjs +47 -0
- package/dist/util/unzipp.d.cts +3 -0
- package/dist/util/unzipp.d.ts +3 -4
- package/dist/util/unzipp.js +7 -12
- package/package.json +35 -33
- package/src/narou-fetch.ts +6 -16
- package/src/narou-jsonp.ts +0 -2
- package/src/narou-ranking-results.ts +10 -0
- package/src/narou-search-results.ts +118 -63
- package/src/narou.ts +42 -3
- package/src/params.ts +220 -61
- package/src/user-search.ts +109 -109
- package/src/util/unzipp.ts +13 -3
- package/dist/index.browser.d.ts.map +0 -1
- package/dist/index.browser.js.map +0 -1
- package/dist/index.common.d.ts.map +0 -1
- package/dist/index.common.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/narou-fetch.d.ts.map +0 -1
- package/dist/narou-fetch.js.map +0 -1
- package/dist/narou-jsonp.d.ts.map +0 -1
- package/dist/narou-jsonp.js.map +0 -1
- package/dist/narou-ranking-results.d.ts.map +0 -1
- package/dist/narou-ranking-results.js.map +0 -1
- package/dist/narou-search-results.d.ts.map +0 -1
- package/dist/narou-search-results.js.map +0 -1
- package/dist/narou.d.ts.map +0 -1
- package/dist/narou.js.map +0 -1
- package/dist/params.d.ts.map +0 -1
- package/dist/params.js.map +0 -1
- package/dist/ranking-history.d.ts.map +0 -1
- package/dist/ranking-history.js.map +0 -1
- package/dist/ranking.d.ts.map +0 -1
- package/dist/ranking.js.map +0 -1
- package/dist/search-builder-r18.d.ts.map +0 -1
- package/dist/search-builder-r18.js.map +0 -1
- package/dist/search-builder.d.ts.map +0 -1
- package/dist/search-builder.js.map +0 -1
- package/dist/user-search.d.ts.map +0 -1
- package/dist/user-search.js.map +0 -1
- package/dist/util/jsonp.d.ts.map +0 -1
- package/dist/util/jsonp.js.map +0 -1
- package/dist/util/type.d.ts.map +0 -1
- package/dist/util/type.js.map +0 -1
- package/dist/util/unzipp.d.ts.map +0 -1
- package/dist/util/unzipp.js.map +0 -1
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { RankingType } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { R as RankingType } from './narou-search-results-b7c10db0.js';
|
|
2
|
+
import './util/type.js';
|
|
3
|
+
|
|
4
|
+
interface RankingHistoryRawResult {
|
|
5
|
+
rtype: `${string}-${RankingType}`;
|
|
6
|
+
pt: number;
|
|
7
|
+
rank: number;
|
|
8
|
+
}
|
|
9
|
+
interface RankingHistoryResult {
|
|
10
|
+
type: RankingType;
|
|
11
|
+
date: Date;
|
|
12
|
+
pt: number;
|
|
13
|
+
rank: number;
|
|
14
|
+
}
|
|
15
|
+
declare function formatRankingHistory(rankin: RankingHistoryRawResult): RankingHistoryResult;
|
|
16
|
+
|
|
17
|
+
export { RankingHistoryRawResult, RankingHistoryResult, formatRankingHistory };
|
package/dist/ranking-history.js
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const [_date, _type] = rtype.split("-");
|
|
9
|
-
const date = (0, date_fns_1.parse)(_date, dateFormat, new Date());
|
|
10
|
-
const type = _type;
|
|
11
|
-
return { type, date, pt, rank };
|
|
12
|
-
}
|
|
13
|
-
exports.formatRankingHistory = formatRankingHistory;
|
|
14
|
-
//# sourceMappingURL=ranking-history.js.map
|
|
1
|
+
import {
|
|
2
|
+
formatRankingHistory
|
|
3
|
+
} from "./chunk-5OZA6DNS.js";
|
|
4
|
+
import "./chunk-IKR7OZGM.js";
|
|
5
|
+
export {
|
|
6
|
+
formatRankingHistory
|
|
7
|
+
};
|
package/dist/ranking.cjs
ADDED
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ranking.ts
|
|
21
|
+
var ranking_exports = {};
|
|
22
|
+
__export(ranking_exports, {
|
|
23
|
+
default: () => RankingBuilder
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(ranking_exports);
|
|
26
|
+
|
|
27
|
+
// src/params.ts
|
|
28
|
+
var RankingType = {
|
|
29
|
+
Daily: "d",
|
|
30
|
+
Weekly: "w",
|
|
31
|
+
Monthly: "m",
|
|
32
|
+
Quarterly: "q"
|
|
33
|
+
};
|
|
34
|
+
var BooleanNumber = {
|
|
35
|
+
True: 1,
|
|
36
|
+
False: 0
|
|
37
|
+
};
|
|
38
|
+
var Fields = {
|
|
39
|
+
/** 小説名 */
|
|
40
|
+
title: "t",
|
|
41
|
+
/** Nコード */
|
|
42
|
+
ncode: "n",
|
|
43
|
+
/** 作者のユーザID(数値) */
|
|
44
|
+
userid: "u",
|
|
45
|
+
/** 作者名 */
|
|
46
|
+
writer: "w",
|
|
47
|
+
/** 小説のあらすじ */
|
|
48
|
+
story: "s",
|
|
49
|
+
/** 大ジャンル */
|
|
50
|
+
biggenre: "bg",
|
|
51
|
+
/** ジャンル */
|
|
52
|
+
genre: "g",
|
|
53
|
+
/** キーワード */
|
|
54
|
+
keyword: "k",
|
|
55
|
+
/** 初回掲載日 */
|
|
56
|
+
general_firstup: "gf",
|
|
57
|
+
/** 最終掲載日 */
|
|
58
|
+
general_lastup: "gl",
|
|
59
|
+
/** 連載の場合は1、短編の場合は2 */
|
|
60
|
+
noveltype: "nt",
|
|
61
|
+
/** 短編小説と完結済小説は0となっています。連載中は1です。 */
|
|
62
|
+
end: "e",
|
|
63
|
+
/** 全掲載部分数 */
|
|
64
|
+
general_all_no: "ga",
|
|
65
|
+
/** 小説文字数 */
|
|
66
|
+
length: "l",
|
|
67
|
+
/** 読了時間(分単位) */
|
|
68
|
+
time: "ti",
|
|
69
|
+
/** 長期連載停止中 */
|
|
70
|
+
isstop: "i",
|
|
71
|
+
/** 登録必須キーワードに「R15」が含まれる場合は1、それ以外は0です。 */
|
|
72
|
+
isr15: "isr",
|
|
73
|
+
/** 登録必須キーワードに「ボーイズラブ」が含まれる場合は1、それ以外は0です。 */
|
|
74
|
+
isbl: "ibl",
|
|
75
|
+
/** 登録必須キーワードに「ガールズラブ」が含まれる場合は1、それ以外は0です。 */
|
|
76
|
+
isgl: "igl",
|
|
77
|
+
/** 登録必須キーワードに「残酷な描写あり」が含まれる場合は1、それ以外は0です。 */
|
|
78
|
+
iszankoku: "izk",
|
|
79
|
+
/** 登録必須キーワードに「異世界転生」が含まれる場合は1、それ以外は0です。 */
|
|
80
|
+
istensei: "its",
|
|
81
|
+
/** 登録必須キーワードに「異世界転移」が含まれる場合は1、それ以外は0です。 */
|
|
82
|
+
istenni: "iti",
|
|
83
|
+
/** 総合評価ポイント */
|
|
84
|
+
global_point: "gp",
|
|
85
|
+
/** 日間ポイント */
|
|
86
|
+
daily_point: "dp",
|
|
87
|
+
/** 週間ポイント */
|
|
88
|
+
weekly_point: "wp",
|
|
89
|
+
/** 月間ポイント */
|
|
90
|
+
monthly_point: "mp",
|
|
91
|
+
/** 四半期ポイント */
|
|
92
|
+
quarter_point: "qp",
|
|
93
|
+
/** 年間ポイント */
|
|
94
|
+
yearly_point: "yp",
|
|
95
|
+
/** ブックマーク数 */
|
|
96
|
+
fav_novel_cnt: "f",
|
|
97
|
+
/** 感想数 */
|
|
98
|
+
impression_cnt: "imp",
|
|
99
|
+
/** レビュー数 */
|
|
100
|
+
review_cnt: "r",
|
|
101
|
+
/** 評価ポイント */
|
|
102
|
+
all_point: "a",
|
|
103
|
+
/** 評価者数 */
|
|
104
|
+
all_hyoka_cnt: "ah",
|
|
105
|
+
/** 挿絵の数 */
|
|
106
|
+
sasie_cnt: "sa",
|
|
107
|
+
/** 会話率 */
|
|
108
|
+
kaiwaritu: "ka",
|
|
109
|
+
/** 小説の更新日時 */
|
|
110
|
+
novelupdated_at: "nu",
|
|
111
|
+
/**
|
|
112
|
+
* 最終更新日時
|
|
113
|
+
* システム用で小説更新時とは関係ありません
|
|
114
|
+
*/
|
|
115
|
+
updated_at: "ua"
|
|
116
|
+
};
|
|
117
|
+
var R18Site = {
|
|
118
|
+
/** ノクターンノベルズ(男性向け) */
|
|
119
|
+
Nocturne: 1,
|
|
120
|
+
/** ムーンライトノベルズ(女性向け) */
|
|
121
|
+
MoonLight: 2,
|
|
122
|
+
/** ムーンライトノベルズ(BL) */
|
|
123
|
+
MoonLightBL: 3,
|
|
124
|
+
/** ミッドナイトノベルズ(大人向け) */
|
|
125
|
+
Midnight: 4
|
|
126
|
+
};
|
|
127
|
+
var R18SiteNotation = {
|
|
128
|
+
[R18Site.Nocturne]: "\u30CE\u30AF\u30BF\u30FC\u30F3\u30CE\u30D9\u30EB\u30BA(\u7537\u6027\u5411\u3051)",
|
|
129
|
+
[R18Site.MoonLight]: "\u30E0\u30FC\u30F3\u30E9\u30A4\u30C8\u30CE\u30D9\u30EB\u30BA(\u5973\u6027\u5411\u3051)",
|
|
130
|
+
[R18Site.MoonLightBL]: "\u30E0\u30FC\u30F3\u30E9\u30A4\u30C8\u30CE\u30D9\u30EB\u30BA(BL)",
|
|
131
|
+
[R18Site.Midnight]: "\u30DF\u30C3\u30C9\u30CA\u30A4\u30C8\u30CE\u30D9\u30EB\u30BA(\u5927\u4EBA\u5411\u3051)"
|
|
132
|
+
};
|
|
133
|
+
var BigGenre = {
|
|
134
|
+
/** 恋愛 */
|
|
135
|
+
Renai: 1,
|
|
136
|
+
/** ファンタジー */
|
|
137
|
+
Fantasy: 2,
|
|
138
|
+
/** 文芸 */
|
|
139
|
+
Bungei: 3,
|
|
140
|
+
/** SF */
|
|
141
|
+
Sf: 4,
|
|
142
|
+
/** その他 */
|
|
143
|
+
Sonota: 99,
|
|
144
|
+
/** ノンジャンル */
|
|
145
|
+
NonGenre: 98
|
|
146
|
+
};
|
|
147
|
+
var BigGenreNotation = {
|
|
148
|
+
[BigGenre.Renai]: "\u604B\u611B",
|
|
149
|
+
[BigGenre.Fantasy]: "\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC",
|
|
150
|
+
[BigGenre.Bungei]: "\u6587\u82B8",
|
|
151
|
+
[BigGenre.Sf]: "SF",
|
|
152
|
+
[BigGenre.Sonota]: "\u305D\u306E\u4ED6",
|
|
153
|
+
[BigGenre.NonGenre]: "\u30CE\u30F3\u30B8\u30E3\u30F3\u30EB"
|
|
154
|
+
};
|
|
155
|
+
var Genre = {
|
|
156
|
+
/** 異世界〔恋愛〕*/
|
|
157
|
+
RenaiIsekai: 101,
|
|
158
|
+
/** 現実世界〔恋愛〕*/
|
|
159
|
+
RenaiGenjitsusekai: 102,
|
|
160
|
+
/** ハイファンタジー〔ファンタジー〕*/
|
|
161
|
+
FantasyHigh: 201,
|
|
162
|
+
/** ローファンタジー〔ファンタジー〕*/
|
|
163
|
+
FantasyLow: 202,
|
|
164
|
+
/** 純文学〔文芸〕*/
|
|
165
|
+
BungeiJyunbungei: 301,
|
|
166
|
+
/** ヒューマンドラマ〔文芸〕*/
|
|
167
|
+
BungeiHumanDrama: 302,
|
|
168
|
+
/** 歴史〔文芸〕*/
|
|
169
|
+
BungeiHistory: 303,
|
|
170
|
+
/** 推理〔文芸〕*/
|
|
171
|
+
BungeiSuiri: 304,
|
|
172
|
+
/** ホラー〔文芸〕*/
|
|
173
|
+
BungeiHorror: 305,
|
|
174
|
+
/** アクション〔文芸〕*/
|
|
175
|
+
BungeiAction: 306,
|
|
176
|
+
/** コメディー〔文芸〕*/
|
|
177
|
+
BungeiComedy: 307,
|
|
178
|
+
/** VRゲーム〔SF〕*/
|
|
179
|
+
SfVrgame: 401,
|
|
180
|
+
/** 宇宙〔SF〕*/
|
|
181
|
+
SfSpace: 402,
|
|
182
|
+
/** 空想科学〔SF〕*/
|
|
183
|
+
SfKuusoukagaku: 403,
|
|
184
|
+
/** パニック〔SF〕*/
|
|
185
|
+
SfPanic: 404,
|
|
186
|
+
/** 童話〔その他〕*/
|
|
187
|
+
SonotaDouwa: 9901,
|
|
188
|
+
/** 詩〔その他〕*/
|
|
189
|
+
SonotaShi: 9902,
|
|
190
|
+
/** エッセイ〔その他〕*/
|
|
191
|
+
SonotaEssei: 9903,
|
|
192
|
+
/** リプレイ〔その他〕*/
|
|
193
|
+
SonotaReplay: 9904,
|
|
194
|
+
/** その他〔その他〕 */
|
|
195
|
+
SonotaSonota: 9999,
|
|
196
|
+
/** ノンジャンル〔ノンジャンル〕*/
|
|
197
|
+
NonGenre: 9801
|
|
198
|
+
};
|
|
199
|
+
var GenreNotation = {
|
|
200
|
+
[Genre.RenaiIsekai]: "\u7570\u4E16\u754C\u3014\u604B\u611B\u3015",
|
|
201
|
+
[Genre.RenaiGenjitsusekai]: "\u73FE\u5B9F\u4E16\u754C\u3014\u604B\u611B\u3015",
|
|
202
|
+
[Genre.FantasyHigh]: "\u30CF\u30A4\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3014\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3015",
|
|
203
|
+
[Genre.FantasyLow]: "\u30ED\u30FC\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3014\u30D5\u30A1\u30F3\u30BF\u30B8\u30FC\u3015",
|
|
204
|
+
[Genre.BungeiJyunbungei]: "\u7D14\u6587\u5B66\u3014\u6587\u82B8\u3015",
|
|
205
|
+
[Genre.BungeiHumanDrama]: "\u30D2\u30E5\u30FC\u30DE\u30F3\u30C9\u30E9\u30DE\u3014\u6587\u82B8\u3015",
|
|
206
|
+
[Genre.BungeiHistory]: "\u6B74\u53F2\u3014\u6587\u82B8\u3015",
|
|
207
|
+
[Genre.BungeiSuiri]: "\u63A8\u7406\u3014\u6587\u82B8\u3015",
|
|
208
|
+
[Genre.BungeiHorror]: "\u30DB\u30E9\u30FC\u3014\u6587\u82B8\u3015",
|
|
209
|
+
[Genre.BungeiAction]: "\u30A2\u30AF\u30B7\u30E7\u30F3\u3014\u6587\u82B8\u3015",
|
|
210
|
+
[Genre.BungeiComedy]: "\u30B3\u30E1\u30C7\u30A3\u30FC\u3014\u6587\u82B8\u3015",
|
|
211
|
+
[Genre.SfVrgame]: "VR\u30B2\u30FC\u30E0\u3014SF\u3015",
|
|
212
|
+
[Genre.SfSpace]: "\u5B87\u5B99\u3014SF\u3015",
|
|
213
|
+
[Genre.SfKuusoukagaku]: "\u7A7A\u60F3\u79D1\u5B66\u3014SF\u3015",
|
|
214
|
+
[Genre.SfPanic]: "\u30D1\u30CB\u30C3\u30AF\u3014SF\u3015",
|
|
215
|
+
[Genre.SonotaDouwa]: "\u7AE5\u8A71\u3014\u305D\u306E\u4ED6\u3015",
|
|
216
|
+
[Genre.SonotaShi]: "\u8A69\u3014\u305D\u306E\u4ED6\u3015",
|
|
217
|
+
[Genre.SonotaEssei]: "\u30A8\u30C3\u30BB\u30A4\u3014\u305D\u306E\u4ED6\u3015",
|
|
218
|
+
[Genre.SonotaReplay]: "\u30EA\u30D7\u30EC\u30A4\u3014\u305D\u306E\u4ED6\u3015",
|
|
219
|
+
[Genre.SonotaSonota]: "\u305D\u306E\u4ED6\u3014\u305D\u306E\u4ED6\u3015",
|
|
220
|
+
[Genre.NonGenre]: "\u30CE\u30F3\u30B8\u30E3\u30F3\u30EB\u3014\u30CE\u30F3\u30B8\u30E3\u30F3\u30EB\u3015"
|
|
221
|
+
};
|
|
222
|
+
var StopParam = {
|
|
223
|
+
/** 長期連載停止中を除きます */
|
|
224
|
+
NoStopping: 1,
|
|
225
|
+
/** 長期連載停止中のみ取得します */
|
|
226
|
+
Stopping: 2
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// src/search-builder.ts
|
|
230
|
+
var SearchBuilderBase = class {
|
|
231
|
+
/**
|
|
232
|
+
* constructor
|
|
233
|
+
* @private
|
|
234
|
+
*/
|
|
235
|
+
constructor(params = {}, api) {
|
|
236
|
+
this.params = params;
|
|
237
|
+
this.api = api;
|
|
238
|
+
}
|
|
239
|
+
static distinct(array) {
|
|
240
|
+
return Array.from(new Set(array));
|
|
241
|
+
}
|
|
242
|
+
static array2string(n) {
|
|
243
|
+
if (Array.isArray(n)) {
|
|
244
|
+
return this.distinct(n).join("-");
|
|
245
|
+
} else {
|
|
246
|
+
return n.toString();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
*
|
|
251
|
+
* @return {SearchBuilder} this
|
|
252
|
+
*/
|
|
253
|
+
limit(num) {
|
|
254
|
+
this.set({ lim: num });
|
|
255
|
+
return this;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
*
|
|
259
|
+
* @return {SearchBuilder} this
|
|
260
|
+
*/
|
|
261
|
+
start(num) {
|
|
262
|
+
this.set({ st: num });
|
|
263
|
+
return this;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
*
|
|
267
|
+
* @return {SearchBuilder} this
|
|
268
|
+
*/
|
|
269
|
+
page(no, count = 20) {
|
|
270
|
+
return this.limit(count).start(no * count);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* 出力順序を指定する。指定しない場合は新着順となります。
|
|
274
|
+
* old 古い順
|
|
275
|
+
* @param {TOrder} order 出力順序
|
|
276
|
+
* @return {SearchBuilder} this
|
|
277
|
+
*/
|
|
278
|
+
order(order) {
|
|
279
|
+
this.set({ order });
|
|
280
|
+
return this;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* gzip圧縮する。
|
|
284
|
+
*
|
|
285
|
+
* 転送量上限を減らすためにも推奨
|
|
286
|
+
* @param {GzipLevel} level gzip圧縮レベル(1~5)
|
|
287
|
+
* @return {SearchBuilder} this
|
|
288
|
+
*/
|
|
289
|
+
gzip(level) {
|
|
290
|
+
this.set({ gzip: level });
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* クエリパラメータをセットする
|
|
295
|
+
* @private
|
|
296
|
+
* @return {SearchBuilder} this
|
|
297
|
+
*/
|
|
298
|
+
set(obj) {
|
|
299
|
+
this.params = { ...this.params, ...obj };
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* クエリパラメータを削除する
|
|
304
|
+
*/
|
|
305
|
+
unset(key) {
|
|
306
|
+
delete this.params[key];
|
|
307
|
+
return this;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
var NovelSearchBuilderBase = class _NovelSearchBuilderBase extends SearchBuilderBase {
|
|
311
|
+
/**
|
|
312
|
+
* a
|
|
313
|
+
* @return {SearchBuilder} this
|
|
314
|
+
*/
|
|
315
|
+
word(word) {
|
|
316
|
+
this.set({ word });
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
*
|
|
321
|
+
* @return {SearchBuilder} this
|
|
322
|
+
*/
|
|
323
|
+
notWord(word) {
|
|
324
|
+
this.set({ notword: word });
|
|
325
|
+
return this;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
*
|
|
329
|
+
* @return {SearchBuilder} this
|
|
330
|
+
*/
|
|
331
|
+
byTitle(bool = true) {
|
|
332
|
+
this.set({ title: bool ? BooleanNumber.True : BooleanNumber.False });
|
|
333
|
+
return this;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
*
|
|
337
|
+
* @return {SearchBuilder} this
|
|
338
|
+
*/
|
|
339
|
+
byOutline(bool = true) {
|
|
340
|
+
this.set({ ex: bool ? BooleanNumber.True : BooleanNumber.False });
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
*
|
|
345
|
+
* @return {SearchBuilder} this
|
|
346
|
+
*/
|
|
347
|
+
byKeyword(bool = true) {
|
|
348
|
+
this.set({ keyword: bool ? BooleanNumber.True : BooleanNumber.False });
|
|
349
|
+
return this;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
*
|
|
353
|
+
* @return {SearchBuilder} this
|
|
354
|
+
*/
|
|
355
|
+
byAuthor(bool = true) {
|
|
356
|
+
this.set({ wname: bool ? BooleanNumber.True : BooleanNumber.False });
|
|
357
|
+
return this;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
*
|
|
361
|
+
* @return {SearchBuilder} this
|
|
362
|
+
*/
|
|
363
|
+
isBL(bool = true) {
|
|
364
|
+
if (bool) {
|
|
365
|
+
this.set({ isbl: BooleanNumber.True });
|
|
366
|
+
} else {
|
|
367
|
+
this.set({ notbl: BooleanNumber.True });
|
|
368
|
+
}
|
|
369
|
+
return this;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
*
|
|
373
|
+
* @return {SearchBuilder} this
|
|
374
|
+
*/
|
|
375
|
+
isGL(bool = true) {
|
|
376
|
+
if (bool) {
|
|
377
|
+
this.set({ isgl: BooleanNumber.True });
|
|
378
|
+
} else {
|
|
379
|
+
this.set({ notgl: BooleanNumber.True });
|
|
380
|
+
}
|
|
381
|
+
return this;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
*
|
|
385
|
+
* @return {SearchBuilder} this
|
|
386
|
+
*/
|
|
387
|
+
isZankoku(bool = true) {
|
|
388
|
+
if (bool) {
|
|
389
|
+
this.set({ iszankoku: BooleanNumber.True });
|
|
390
|
+
} else {
|
|
391
|
+
this.set({ notzankoku: BooleanNumber.True });
|
|
392
|
+
}
|
|
393
|
+
return this;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
*
|
|
397
|
+
* @return {SearchBuilder} this
|
|
398
|
+
*/
|
|
399
|
+
isTensei(bool = true) {
|
|
400
|
+
if (bool) {
|
|
401
|
+
this.set({ istensei: BooleanNumber.True });
|
|
402
|
+
} else {
|
|
403
|
+
this.set({ nottensei: BooleanNumber.True });
|
|
404
|
+
}
|
|
405
|
+
return this;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
*
|
|
409
|
+
* @return {SearchBuilder} this
|
|
410
|
+
*/
|
|
411
|
+
isTenni(bool = true) {
|
|
412
|
+
if (bool) {
|
|
413
|
+
this.set({ istenni: BooleanNumber.True });
|
|
414
|
+
} else {
|
|
415
|
+
this.set({ nottenni: BooleanNumber.True });
|
|
416
|
+
}
|
|
417
|
+
return this;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
*
|
|
421
|
+
* @return {SearchBuilder} this
|
|
422
|
+
*/
|
|
423
|
+
isTT() {
|
|
424
|
+
this.set({ istt: BooleanNumber.True });
|
|
425
|
+
return this;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
*
|
|
429
|
+
* @return {SearchBuilder} this
|
|
430
|
+
*/
|
|
431
|
+
length(length) {
|
|
432
|
+
this.set({ length: _NovelSearchBuilderBase.array2string(length) });
|
|
433
|
+
return this;
|
|
434
|
+
}
|
|
435
|
+
kaiwaritu(min, max) {
|
|
436
|
+
let n;
|
|
437
|
+
if (max != null) {
|
|
438
|
+
n = `${min}-${max}`;
|
|
439
|
+
} else {
|
|
440
|
+
n = min;
|
|
441
|
+
}
|
|
442
|
+
this.set({ kaiwaritu: n });
|
|
443
|
+
return this;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
*
|
|
447
|
+
* @return {SearchBuilder} this
|
|
448
|
+
*/
|
|
449
|
+
sasie(num) {
|
|
450
|
+
this.set({ sasie: _NovelSearchBuilderBase.array2string(num) });
|
|
451
|
+
return this;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
*
|
|
455
|
+
* @return {SearchBuilder} this
|
|
456
|
+
*/
|
|
457
|
+
time(num) {
|
|
458
|
+
this.set({ time: _NovelSearchBuilderBase.array2string(num) });
|
|
459
|
+
return this;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
*
|
|
463
|
+
* @return {SearchBuilder} this
|
|
464
|
+
*/
|
|
465
|
+
ncode(ncodes) {
|
|
466
|
+
this.set({ ncode: _NovelSearchBuilderBase.array2string(ncodes) });
|
|
467
|
+
return this;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
*
|
|
471
|
+
* @return {SearchBuilder} this
|
|
472
|
+
*/
|
|
473
|
+
type(type) {
|
|
474
|
+
this.set({ type });
|
|
475
|
+
return this;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
*
|
|
479
|
+
* @return {SearchBuilder} this
|
|
480
|
+
*/
|
|
481
|
+
buntai(buntai) {
|
|
482
|
+
this.set({ buntai: _NovelSearchBuilderBase.array2string(buntai) });
|
|
483
|
+
return this;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
*
|
|
487
|
+
* @return {SearchBuilder} this
|
|
488
|
+
*/
|
|
489
|
+
isStop(bool = true) {
|
|
490
|
+
this.set({ stop: bool ? StopParam.Stopping : StopParam.NoStopping });
|
|
491
|
+
return this;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
*
|
|
495
|
+
* @return {SearchBuilder} this
|
|
496
|
+
*/
|
|
497
|
+
isPickup(bool = true) {
|
|
498
|
+
this.set({ ispickup: bool ? BooleanNumber.True : BooleanNumber.False });
|
|
499
|
+
return this;
|
|
500
|
+
}
|
|
501
|
+
lastUpdate(x, y) {
|
|
502
|
+
let date;
|
|
503
|
+
if (typeof x == "string") {
|
|
504
|
+
date = x;
|
|
505
|
+
} else if (x instanceof Date && y instanceof Date) {
|
|
506
|
+
date = `${Math.floor(x.getTime() / 1e3)}-${Math.floor(
|
|
507
|
+
x.getTime() / 1e3
|
|
508
|
+
)}`;
|
|
509
|
+
} else {
|
|
510
|
+
date = `${x}-${y}`;
|
|
511
|
+
}
|
|
512
|
+
this.set({ lastup: date });
|
|
513
|
+
return this;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* なろう小説APIへの検索リクエストを実行する
|
|
517
|
+
* @returns {Promise<NarouSearchResults>} 検索結果
|
|
518
|
+
*/
|
|
519
|
+
execute() {
|
|
520
|
+
return this.api.executeNovel(this.params);
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
var SearchBuilder = class _SearchBuilder extends NovelSearchBuilderBase {
|
|
524
|
+
/**
|
|
525
|
+
*
|
|
526
|
+
* @return {SearchBuilder} this
|
|
527
|
+
*/
|
|
528
|
+
bigGenre(genre) {
|
|
529
|
+
this.set({ biggenre: _SearchBuilder.array2string(genre) });
|
|
530
|
+
return this;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
*
|
|
534
|
+
* @return {SearchBuilder} this
|
|
535
|
+
*/
|
|
536
|
+
notBigGenre(genre) {
|
|
537
|
+
this.set({ notbiggenre: _SearchBuilder.array2string(genre) });
|
|
538
|
+
return this;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
*
|
|
542
|
+
* @return {SearchBuilder} this
|
|
543
|
+
*/
|
|
544
|
+
genre(genre) {
|
|
545
|
+
this.set({ genre: _SearchBuilder.array2string(genre) });
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
*
|
|
550
|
+
* @return {SearchBuilder} this
|
|
551
|
+
*/
|
|
552
|
+
notGenre(genre) {
|
|
553
|
+
this.set({ notgenre: _SearchBuilder.array2string(genre) });
|
|
554
|
+
return this;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
*
|
|
558
|
+
* @return {SearchBuilder} this
|
|
559
|
+
*/
|
|
560
|
+
userId(ids) {
|
|
561
|
+
this.set({ userid: _SearchBuilder.array2string(ids) });
|
|
562
|
+
return this;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
*
|
|
566
|
+
* @return {SearchBuilder} this
|
|
567
|
+
*/
|
|
568
|
+
isR15(bool = true) {
|
|
569
|
+
if (bool) {
|
|
570
|
+
this.set({ isr15: 1 });
|
|
571
|
+
} else {
|
|
572
|
+
this.set({ notr15: 1 });
|
|
573
|
+
}
|
|
574
|
+
return this;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
*
|
|
578
|
+
* @return {SearchBuilder} this
|
|
579
|
+
*/
|
|
580
|
+
fields(fields) {
|
|
581
|
+
this.set({ of: _SearchBuilder.array2string(fields) });
|
|
582
|
+
return this;
|
|
583
|
+
}
|
|
584
|
+
opt(option) {
|
|
585
|
+
this.set({ opt: _SearchBuilder.array2string(option) });
|
|
586
|
+
return this;
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// src/ranking.ts
|
|
591
|
+
var import_date_fns = require("date-fns");
|
|
592
|
+
var dateFormat = "yyyyMMdd";
|
|
593
|
+
var RankingBuilder = class {
|
|
594
|
+
/**
|
|
595
|
+
* constructor
|
|
596
|
+
* @private
|
|
597
|
+
*/
|
|
598
|
+
constructor(params = {}, api) {
|
|
599
|
+
this.params = params;
|
|
600
|
+
this.api = api;
|
|
601
|
+
this.date$ = (0, import_date_fns.addDays)(Date.now(), -1);
|
|
602
|
+
this.type$ = RankingType.Daily;
|
|
603
|
+
}
|
|
604
|
+
date(date) {
|
|
605
|
+
this.date$ = date;
|
|
606
|
+
return this;
|
|
607
|
+
}
|
|
608
|
+
type(type) {
|
|
609
|
+
this.type$ = type;
|
|
610
|
+
return this;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* gzip圧縮する。
|
|
614
|
+
*
|
|
615
|
+
* 転送量上限を減らすためにも推奨
|
|
616
|
+
* @param {GzipLevel} level gzip圧縮レベル(1~5)
|
|
617
|
+
* @return {RankingBuilder} this
|
|
618
|
+
*/
|
|
619
|
+
gzip(level) {
|
|
620
|
+
this.set({ gzip: level });
|
|
621
|
+
return this;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* クエリパラメータをセットする
|
|
625
|
+
* @private
|
|
626
|
+
* @return {RankingBuilder} this
|
|
627
|
+
*/
|
|
628
|
+
set(obj) {
|
|
629
|
+
Object.assign(this.params, obj);
|
|
630
|
+
return this;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* なろう小説APIへのリクエストを実行する
|
|
634
|
+
* @returns ランキング
|
|
635
|
+
*/
|
|
636
|
+
execute() {
|
|
637
|
+
const date = (0, import_date_fns.format)(this.date$, dateFormat);
|
|
638
|
+
this.set({ rtype: `${date}-${this.type$}` });
|
|
639
|
+
return this.api.executeRanking(this.params);
|
|
640
|
+
}
|
|
641
|
+
async executeWithFields(fields = [], opt) {
|
|
642
|
+
const ranking = await this.execute();
|
|
643
|
+
const fields$ = Array.isArray(fields) ? fields.length == 0 ? [] : [...fields, Fields.ncode] : [fields, Fields.ncode];
|
|
644
|
+
const rankingNcodes = ranking.map(({ ncode }) => ncode);
|
|
645
|
+
const builder = new SearchBuilder({}, this.api);
|
|
646
|
+
builder.fields(fields$);
|
|
647
|
+
if (opt) {
|
|
648
|
+
builder.opt(opt);
|
|
649
|
+
}
|
|
650
|
+
builder.ncode(rankingNcodes);
|
|
651
|
+
builder.limit(ranking.length);
|
|
652
|
+
const result = await builder.execute();
|
|
653
|
+
return ranking.map((r) => ({
|
|
654
|
+
...r,
|
|
655
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
656
|
+
...result.values.find((novel) => novel.ncode == r.ncode)
|
|
657
|
+
}));
|
|
658
|
+
}
|
|
659
|
+
};
|