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

Commite2150c2

Browse files
committed
Fix typos and make it working again
1 parent6ef9877 commite2150c2

File tree

3 files changed

+24
-65
lines changed

3 files changed

+24
-65
lines changed

‎src/CatManga/CatManga.ts‎

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const BASE = "https://catmanga.org"
1515

1616
exportconstCatMangaInfo:SourceInfo={
1717
icon:"icon.png",
18-
version:"1.2.3",
18+
version:"1.2.4",
1919
name:"CatManga",
2020
author:"PythonCoderAS",
2121
authorWebsite:"https://github.com/PythonCoderAS",
@@ -40,16 +40,6 @@ export class CatManga extends Source {
4040

4141
asyncgetHomePageSections(sectionCallback:(section:HomeSection)=>void):Promise<void>{
4242
const$=awaitthis.getHomePageData()
43-
sectionCallback(createHomeSection({
44-
id:"featured",
45-
title:"Featured",
46-
items:this.parser.parseFeatured($,BASE)
47-
}))
48-
sectionCallback(createHomeSection({
49-
id:"latest",
50-
title:"Latest",
51-
items:this.getLatest($)
52-
}))
5343
sectionCallback(createHomeSection({
5444
id:"all",
5545
items:(awaitthis.getWebsiteMangaDirectory(null)).results,
@@ -66,13 +56,9 @@ export class CatManga extends Source {
6656
returnthis.cheerio.load(response.data);
6757
}
6858

69-
getLatest($:CheerioStatic){
70-
returnthis.parser.parseTileList($,"latestChapterListView","latestChapterView");
71-
}
72-
7359
asyncgetWebsiteMangaDirectory(metadata:any):Promise<PagedResults>{
7460
returncreatePagedResults({
75-
results:this.parser.parseTileList(awaitthis.getHomePageData(),"allseries")
61+
results:this.parser.parseHomeTiles(awaitthis.getHomePageData(),BASE)
7662
});
7763
}
7864

‎src/CatManga/CatMangaParser.ts‎

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,28 @@ export class CatMangaParser {
88
})
99
}
1010

11-
parseTileList($:CheerioStatic,className:string,className2:string|null=null){
12-
if(className2===null){
13-
className2=className;
14-
}
15-
constmangaTiles:MangaTile[]=[];
16-
$(`div[class^=${className}_grid] *[class^=${className2}_element]`).map((index,element)=>{
17-
constlinkId=element.attribs["href"];
18-
if(linkId){
19-
consttile:MangaTile={
20-
id:linkId.replace(`/series/`,"").split("/")[0],
21-
title:createIconText({
22-
text:this.decodeHTMLEntity($("p",element).first().text().trim())
23-
}),
24-
image:$("img",element).attr("src")||""
25-
}
26-
if($("p",element).length>1){
27-
tile.primaryText=createIconText({
28-
text:this.decodeHTMLEntity($("p",element).last().text().trim())
29-
});
30-
}
31-
mangaTiles.push(createMangaTile(tile));
32-
}
33-
})
34-
returnmangaTiles;
35-
}
36-
37-
parseFeatured($:CheerioStatic,base:string){
38-
constseen:string[]=[];
11+
parseHomeTiles($:CheerioStatic,base:string){
3912
constmangaTiles:MangaTile[]=[];
40-
$("ul.slider li.slide").map((index,element)=>{
41-
constlink=$("a",element);
42-
constlinkId=link.attr("href")
43-
if(linkId){
44-
constid=linkId.replace(`/series/`,"").split("/")[0];
45-
if(!seen.includes(id)){
46-
seen.push(id);
47-
mangaTiles.push(createMangaTile({
48-
id:id,
49-
title:createIconText({
50-
text:this.decodeHTMLEntity($("h1",element).first().text().trim())
51-
}),
52-
image:base+$("img",element).attr("src")||"",
53-
primaryText:createIconText({
54-
text:this.decodeHTMLEntity($("div p",$("a",element).parent()).first().text().trim())
55-
})
56-
}))
13+
constjson=JSON.parse($("script#__NEXT_DATA__").html()||"{}");
14+
if(json){
15+
constprops=json.props;
16+
if(props){
17+
constpageProps=props.pageProps;
18+
if(pageProps){
19+
constseries=pageProps.series;
20+
for(leti=0;i<series.length;i++){
21+
constitem=series[i];
22+
mangaTiles.push(createMangaTile({
23+
id:item.series_id,
24+
image:item.cover_art.source,
25+
title:createIconText({
26+
text:this.decodeHTMLEntity(item.title)
27+
})
28+
}))
29+
}
5730
}
5831
}
59-
})
32+
}
6033
returnmangaTiles;
6134
}
6235

@@ -138,7 +111,7 @@ export class CatMangaParser {
138111
constpageProps=props.pageProps;
139112
if(pageProps){
140113
constseries=pageProps.series;
141-
if(series&&series.genres&&(series.genres.length||0)>0&&series.title&&series.decription&&series.status&&series.cover_art&&series.conver_art.source){
114+
if(series&&series.genres&&(series.genres.length||0)>0&&series.title&&series.description&&series.status&&series.cover_art&&series.cover_art.source){
142115
lettitles=[series.title]
143116
constcovers=[];
144117
consttags=[]
@@ -189,7 +162,7 @@ export class CatMangaParser {
189162
}
190163
}
191164
}
192-
returnthis.parseMangaFallback($,mangaId);
165+
thrownewError("Bug!")
193166
}
194167

195168
parseMangaFallback($:CheerioStatic,mangaId:string){

‎src/tests/DankeFurs.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("DankeFurs Tests", function () {
5757

5858
it("Testing search",async()=>{
5959
lettestSearch=createSearchRequest({
60-
title:"kazu",
60+
title:"Crossdressing",
6161
});
6262

6363
letsearch=awaitwrapper.searchRequest(source,testSearch);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp