Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit689eb0d

Browse files
committed
Add NovelCool
1 parent2a12325 commit689eb0d

File tree

4 files changed

+590
-0
lines changed

4 files changed

+590
-0
lines changed

‎src/NovelCool/NovelCool.ts‎

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
import{
2+
Chapter,
3+
ChapterDetails,
4+
HomeSection,
5+
Manga,
6+
MangaUpdates,
7+
PagedResults,
8+
Request,
9+
SearchRequest,
10+
Source,
11+
SourceInfo,
12+
TagSection,
13+
}from"paperback-extensions-common"
14+
import{NovelCoolParser}from"./NovelCoolParser";
15+
16+
constBASE="https://www.novelcool.com"
17+
18+
exportconstNovelCoolInfo:SourceInfo={
19+
icon:"icon.png",
20+
version:"1.0.1",
21+
name:"NovelCool",
22+
author:"PythonCoderAS",
23+
authorWebsite:"https://github.com/PythonCoderAS",
24+
description:"Extension that pulls manga from NovelCool",
25+
language:"en",
26+
hentaiSource:false,
27+
websiteBaseURL:BASE
28+
}
29+
30+
exportclassNovelCoolextendsSource{
31+
32+
privatereadonlyparser:NovelCoolParser=newNovelCoolParser();
33+
34+
getMangaShareUrl(mangaId:string):string{
35+
return`${BASE}/novel/${mangaId}.html`;
36+
}
37+
38+
asyncgetTags():Promise<TagSection[]|null>{
39+
constoptions:Request=createRequestObject({
40+
url:`${BASE}/search?name=awdasdsadsa`,
41+
method:'GET'
42+
});
43+
letresponse=awaitthis.requestManager.schedule(options,1);
44+
let$=this.cheerio.load(response.data);
45+
returnthis.parser.parseGlobalTagList($);
46+
}
47+
48+
asyncgetHomePageSections(sectionCallback:(section:HomeSection)=>void):Promise<void>{
49+
constoptions:Request=createRequestObject({
50+
url:`${BASE}`,
51+
method:'GET'
52+
});
53+
letresponse=awaitthis.requestManager.schedule(options,1);
54+
let$=this.cheerio.load(response.data);
55+
letcarouselItems=this.parser.parseCarousel($,BASE);
56+
sectionCallback(createHomeSection({
57+
id:"carousel",
58+
title:"Popular",
59+
items:carouselItems
60+
}))
61+
constsections=this.parser.parseHomepage($,BASE);
62+
for(leti=0;i<sections.length;i++){
63+
constsection=sections[i];
64+
sectionCallback(createHomeSection({
65+
id:section.name.toLowerCase(),
66+
title:section.name,
67+
items:section.items,
68+
view_more:true
69+
}));
70+
}
71+
}
72+
73+
asyncdoGetWebsiteMangaDirectory(page:number=1,end:number|null=null){
74+
constoptions:Request=createRequestObject({
75+
url:`${BASE}/category/index_${page}.html`,
76+
method:'GET'
77+
});
78+
letresponse=awaitthis.requestManager.schedule(options,1);
79+
let$=this.cheerio.load(response.data);
80+
letresults=this.parser.parseMangaListingPage($,BASE);
81+
if(!end){
82+
end=Number($("div.dis-inline-block.para-h8").first().text().trim())
83+
for(leti=2;i<=end;i++){
84+
results=results.concat(awaitthis.doGetWebsiteMangaDirectory(i,end))
85+
}
86+
}
87+
returnresults;
88+
}
89+
90+
asyncgetWebsiteMangaDirectory(metadata:any):Promise<PagedResults>{
91+
returncreatePagedResults({
92+
results:awaitthis.doGetWebsiteMangaDirectory()
93+
});
94+
}
95+
96+
asyncdoGetPages(chapterId:string,page:number=1,end:number|null=null):Promise<string[]>{
97+
constoptions:Request=createRequestObject({
98+
url:`${BASE}/chapter/${chapterId}-10-${page}.html`,
99+
method:'GET'
100+
});
101+
letresponse=awaitthis.requestManager.schedule(options,1);
102+
let$:CheerioStatic=this.cheerio.load(response.data);
103+
letpages:string[]=this.parser.parsePages($);
104+
if(end===null){
105+
end=$("select.sl-page option").length
106+
for(leti=2;i<end;i++){
107+
pages=pages.concat(awaitthis.doGetPages(chapterId,page+1,end));
108+
}
109+
}
110+
returnpages;
111+
}
112+
113+
asyncgetChapterDetails(mangaId:string,chapterId:string):Promise<ChapterDetails>{
114+
returncreateChapterDetails({
115+
id:chapterId,
116+
mangaId:mangaId,
117+
longStrip:false,
118+
pages:awaitthis.doGetPages(chapterId)
119+
});
120+
}
121+
122+
asyncgetChapters(mangaId:string):Promise<Chapter[]>{
123+
constoptions:Request=createRequestObject({
124+
url:this.getMangaShareUrl(mangaId),
125+
method:'GET'
126+
});
127+
letresponse=awaitthis.requestManager.schedule(options,1);
128+
let$=this.cheerio.load(response.data);
129+
returnthis.parser.parseChapterList($,mangaId,BASE,this.convertTime);
130+
}
131+
132+
asyncgetMangaDetails(mangaId:string):Promise<Manga>{
133+
constoptions:Request=createRequestObject({
134+
url:this.getMangaShareUrl(mangaId),
135+
method:'GET'
136+
});
137+
letresponse=awaitthis.requestManager.schedule(options,1);
138+
let$=this.cheerio.load(response.data);
139+
returnthis.parser.parseManga($,mangaId,BASE,this.convertTime);
140+
}
141+
142+
asyncdoSearchRequest(url:string,page:number=1,end:number|null=null){
143+
constoriginal_url=url;
144+
url+=`&page=${page}.html`
145+
constoptions:Request=createRequestObject({
146+
url:url,
147+
method:'GET'
148+
});
149+
letresponse=awaitthis.requestManager.schedule(options,1);
150+
let$=this.cheerio.load(response.data);
151+
if($("div.search-nores-hint").length!==0){
152+
return[];
153+
}else{
154+
letresults=this.parser.parseMangaListingPage($,BASE);
155+
if(!end){
156+
end=Number($("div.dis-inline-block.para-h8").first().text().trim())
157+
for(leti=2;i<=end;i++){
158+
results=results.concat(awaitthis.doSearchRequest(original_url,i,end))
159+
}
160+
}
161+
returnresults;
162+
}
163+
}
164+
165+
asyncsearchRequest(query:SearchRequest,metadata:any):Promise<PagedResults>{
166+
leturl=`${BASE}/search/?name_sel=contain`
167+
if(query.title){
168+
url+=`&name=${query.title}`;
169+
}
170+
if(query.author){
171+
url+=`&author_sel=contain&author=${query.author}`;
172+
}
173+
returncreatePagedResults({
174+
results:awaitthis.doSearchRequest(url)
175+
});
176+
}
177+
178+
asyncgetViewMoreItems(homepageSectionId:string,metadata:any):Promise<PagedResults>{
179+
constoptions:Request=createRequestObject({
180+
url:`${BASE}/category/${homepageSectionId}.html`,
181+
method:'GET'
182+
});
183+
letresponse=awaitthis.requestManager.schedule(options,1);
184+
let$=this.cheerio.load(response.data);
185+
letresults=this.parser.parseMangaListingPage($,BASE);
186+
returncreatePagedResults({
187+
results:results
188+
});
189+
}
190+
191+
asyncfilterUpdatedManga(mangaUpdatesFoundCallback:(updates:MangaUpdates)=>void,time:Date,ids:string[]):Promise<void>{
192+
mangaUpdatesFoundCallback(createMangaUpdates({
193+
ids:ids
194+
}));
195+
}
196+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp