Skip to content

Commit b3b99c1

Browse files
authored
NovelNice (#2395)
1 parent 62f7b46 commit b3b99c1

4 files changed

Lines changed: 357 additions & 0 deletions

File tree

Lines changed: 324 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,324 @@
1+
{
2+
"filters": {
3+
"genre[]": {
4+
"type": "Checkbox",
5+
"label": "Genre",
6+
"value": [],
7+
"options": [
8+
{
9+
"label": "Action",
10+
"value": "action"
11+
},
12+
{
13+
"label": "Adventure",
14+
"value": "adventure"
15+
},
16+
{
17+
"label": "Anime & Comics",
18+
"value": "anime-comics"
19+
},
20+
{
21+
"label": "Comedy",
22+
"value": "comedy"
23+
},
24+
{
25+
"label": "Drama",
26+
"value": "drama"
27+
},
28+
{
29+
"label": "Eastern",
30+
"value": "eastern"
31+
},
32+
{
33+
"label": "Fan-fiction",
34+
"value": "fan-fiction"
35+
},
36+
{
37+
"label": "Fanfiction",
38+
"value": "fanfiction"
39+
},
40+
{
41+
"label": "Fantasy",
42+
"value": "fantasy"
43+
},
44+
{
45+
"label": "Game",
46+
"value": "game"
47+
},
48+
{
49+
"label": "Games",
50+
"value": "games"
51+
},
52+
{
53+
"label": "Gender Bender",
54+
"value": "gender-bender"
55+
},
56+
{
57+
"label": "General",
58+
"value": "general"
59+
},
60+
{
61+
"label": "Harem",
62+
"value": "harem"
63+
},
64+
{
65+
"label": "Historical",
66+
"value": "historical"
67+
},
68+
{
69+
"label": "Horror",
70+
"value": "horror"
71+
},
72+
{
73+
"label": "Isekai",
74+
"value": "isekai"
75+
},
76+
{
77+
"label": "Josei",
78+
"value": "josei"
79+
},
80+
{
81+
"label": "LitRPG",
82+
"value": "litrpg"
83+
},
84+
{
85+
"label": "Magic",
86+
"value": "magic"
87+
},
88+
{
89+
"label": "Magical Realism",
90+
"value": "magical-realism"
91+
},
92+
{
93+
"label": "Martial Arts",
94+
"value": "martial-arts"
95+
},
96+
{
97+
"label": "Mature",
98+
"value": "mature"
99+
},
100+
{
101+
"label": "Mecha",
102+
"value": "mecha"
103+
},
104+
{
105+
"label": "Modern Life",
106+
"value": "modern-life"
107+
},
108+
{
109+
"label": "Mystery",
110+
"value": "mystery"
111+
},
112+
{
113+
"label": "Other",
114+
"value": "other"
115+
},
116+
{
117+
"label": "Psychological",
118+
"value": "psychological"
119+
},
120+
{
121+
"label": "Reincarnation",
122+
"value": "reincarnation"
123+
},
124+
{
125+
"label": "Romance",
126+
"value": "romance"
127+
},
128+
{
129+
"label": "School Life",
130+
"value": "school-life"
131+
},
132+
{
133+
"label": "Sci-fi",
134+
"value": "sci-fi"
135+
},
136+
{
137+
"label": "Seinen",
138+
"value": "seinen"
139+
},
140+
{
141+
"label": "Shoujo",
142+
"value": "shoujo"
143+
},
144+
{
145+
"label": "Shoujo Ai",
146+
"value": "shoujo-ai"
147+
},
148+
{
149+
"label": "Shounen",
150+
"value": "shounen"
151+
},
152+
{
153+
"label": "Shounen Ai",
154+
"value": "shounen-ai"
155+
},
156+
{
157+
"label": "Slice of Life",
158+
"value": "slice-of-life"
159+
},
160+
{
161+
"label": "Smut",
162+
"value": "smut"
163+
},
164+
{
165+
"label": "Sports",
166+
"value": "sports"
167+
},
168+
{
169+
"label": "Supernatural",
170+
"value": "supernatural"
171+
},
172+
{
173+
"label": "System",
174+
"value": "system"
175+
},
176+
{
177+
"label": "Thriller",
178+
"value": "thriller"
179+
},
180+
{
181+
"label": "Tragedy",
182+
"value": "tragedy"
183+
},
184+
{
185+
"label": "Urban",
186+
"value": "urban"
187+
},
188+
{
189+
"label": "Urban Life",
190+
"value": "urban-life"
191+
},
192+
{
193+
"label": "Video Games",
194+
"value": "video-games"
195+
},
196+
{
197+
"label": "War",
198+
"value": "war"
199+
},
200+
{
201+
"label": "Wuxia",
202+
"value": "wuxia"
203+
},
204+
{
205+
"label": "Xianxia",
206+
"value": "xianxia"
207+
},
208+
{
209+
"label": "Xuanhuan",
210+
"value": "xuanhuan"
211+
},
212+
{
213+
"label": "Yaoi",
214+
"value": "yaoi"
215+
},
216+
{
217+
"label": "Yuri",
218+
"value": "yuri"
219+
}
220+
]
221+
},
222+
"op": {
223+
"type": "Switch",
224+
"label": "having all selected genres",
225+
"value": false
226+
},
227+
"author": {
228+
"type": "Text",
229+
"label": "Author",
230+
"value": ""
231+
},
232+
"artist": {
233+
"type": "Text",
234+
"label": "Artist",
235+
"value": ""
236+
},
237+
"release": {
238+
"type": "Text",
239+
"label": "Year of Released",
240+
"value": ""
241+
},
242+
"adult": {
243+
"type": "Picker",
244+
"label": "Adult content",
245+
"value": "",
246+
"options": [
247+
{
248+
"label": "All",
249+
"value": ""
250+
},
251+
{
252+
"label": "None adult content",
253+
"value": "0"
254+
},
255+
{
256+
"label": "Only adult content",
257+
"value": "1"
258+
}
259+
]
260+
},
261+
"status[]": {
262+
"type": "Checkbox",
263+
"label": "Status",
264+
"value": [],
265+
"options": [
266+
{
267+
"label": "OnGoing",
268+
"value": "on-going"
269+
},
270+
{
271+
"label": "Completed",
272+
"value": "end"
273+
},
274+
{
275+
"label": "Canceled",
276+
"value": "canceled"
277+
},
278+
{
279+
"label": "On Hold",
280+
"value": "on-hold"
281+
},
282+
{
283+
"label": "Upcoming",
284+
"value": "upcoming"
285+
}
286+
]
287+
},
288+
"m_orderby": {
289+
"type": "Picker",
290+
"label": "Order by",
291+
"value": "",
292+
"options": [
293+
{
294+
"label": "Relevance",
295+
"value": ""
296+
},
297+
{
298+
"label": "Latest",
299+
"value": "latest"
300+
},
301+
{
302+
"label": "A-Z",
303+
"value": "alphabet"
304+
},
305+
{
306+
"label": "Rating",
307+
"value": "rating"
308+
},
309+
{
310+
"label": "Trending",
311+
"value": "trending"
312+
},
313+
{
314+
"label": "Most Views",
315+
"value": "views"
316+
},
317+
{
318+
"label": "New",
319+
"value": "new-manga"
320+
}
321+
]
322+
}
323+
}
324+
}

plugins/multisrc/madara/sources.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,5 +651,14 @@
651651
"useNewChapterEndpoint": true,
652652
"versionIncrements": 2
653653
}
654+
},
655+
{
656+
"id": "novelnice",
657+
"sourceSite": "https://novelnice.com/",
658+
"sourceName": "Novel Nice",
659+
"options": {
660+
"lang": "English",
661+
"useNewChapterEndpoint": true
662+
}
654663
}
655664
]

plugins/multisrc/madara/template.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,30 @@ export class MadaraPlugin implements Plugin.PluginBase {
304304
method: 'POST',
305305
referrer: this.site + novelPath,
306306
}).then((res: Response) => res.text());
307+
308+
const $firstPage = parseHTML(html);
309+
const pageLinks = $firstPage('.pagination a[data-page]');
310+
if (pageLinks.length > 0) {
311+
const maxPage = Math.max(
312+
...pageLinks
313+
.map((_, el) =>
314+
parseInt($firstPage(el).attr('data-page') || '1', 10),
315+
)
316+
.get(),
317+
);
318+
const lastHref = pageLinks.last().attr('href') || '';
319+
const queryIndex = lastHref.indexOf('?');
320+
if (queryIndex !== -1) {
321+
const queryTemplate = lastHref.slice(queryIndex).replace(/\d+$/, '');
322+
for (let page = 2; page <= maxPage; page++) {
323+
const pageHtml = await fetchApi(
324+
this.site + novelPath + 'ajax/chapters/' + queryTemplate + page,
325+
{ method: 'POST', referrer: this.site + novelPath },
326+
).then((res: Response) => res.text());
327+
if (pageHtml && pageHtml !== '0') html += pageHtml;
328+
}
329+
}
330+
}
307331
} else {
308332
const novelId =
309333
loadedCheerio('.rating-post-id').attr('value') ||
626 Bytes
Loading

0 commit comments

Comments
 (0)