@@ -2,13 +2,16 @@ import {Chapter, LanguageCode, Manga, MangaStatus, MangaTile, Tag} from "paperba
22
33export class RainOfSnowParser {
44
5- parseMangaList ( $ :CheerioStatic , base :string ) {
5+ parseMangaList ( $ :CheerioStatic , base :string , filterElement :Cheerio | null = null ) {
6+ if ( filterElement === null ) {
7+ filterElement = $ . root ( )
8+ }
69const mangaTiles :MangaTile [ ] = [ ] ;
7- $ ( "ul.boxhover1 li" ) . map ( ( ( index , element ) => {
8- const link = $ ( "h4 a" , element ) . first ( ) ;
10+ $ ( "div.col-xs-6.col-md-3.col-lg-2" , filterElement ) . map ( ( ( index , element ) => {
11+ const link = $ ( "h3 a" , element ) . first ( ) ;
912const linkId = link . attr ( "href" ) ;
1013const imgSrc = $ ( "a img" , element ) . first ( ) . attr ( "src" ) ;
11- if ( linkId ) {
14+ if ( linkId && linkId . includes ( "comic" ) ) {
1215mangaTiles . push ( createMangaTile ( {
1316id :linkId . replace ( `${ base } /comic/` , "" ) . slice ( 0 , - 1 ) ,
1417image :imgSrc || "" ,
@@ -33,16 +36,18 @@ export class RainOfSnowParser {
3336
3437parseChapterList ( $ :CheerioStatic , mangaId :string , base :string ) {
3538const chapters :Chapter [ ] = [ ] ;
36- $ ( "ul.chapter1 li" ) . map ( ( index , element ) => {
39+ $ ( "div#chapter li" ) . map ( ( index , element ) => {
3740const link = $ ( "a" , element ) . first ( ) ;
3841const linkId = link . attr ( "href" ) ;
3942if ( linkId ) {
43+ const chapParts = link . text ( ) . split ( "." ) ;
4044chapters . push ( createChapter ( {
41- chapNum :Number ( link . text ( ) . split ( "." ) [ 0 ] ) ,
45+ chapNum :Number ( chapParts [ 0 ] ) ,
4246id :linkId . replace ( base + "/comic_chapters/" , "" ) ,
4347langCode :LanguageCode . ENGLISH ,
4448mangaId :mangaId ,
4549time :new Date ( $ ( "small" , element ) . first ( ) . text ( ) ) ,
50+ name :chapParts [ 1 ] || undefined
4651} ) )
4752}
4853} )
@@ -56,14 +61,9 @@ export class RainOfSnowParser {
5661}
5762
5863parseManga ( $ :CheerioStatic , mangaId :string , base :string ) {
59- const items = $ ( "ul.rat1 li" ) ;
6064const tagList :Tag [ ] = [ ] ;
61- let summary :string = ""
62- $ ( "div.summery div.text p" ) . map ( ( ( index , element ) => {
63- summary += $ ( element ) . text ( ) + "\n"
64- } ) )
65- summary = summary . trim ( ) ;
66- $ ( "a[rel=\"tag\"]" , items ) . map ( ( ( index , element ) => {
65+ const summary :string = $ ( "div#synop" ) . text ( ) . replace ( / \s { 2 , } / , "" ) . trim ( ) ;
66+ $ ( "a[rel=\"tag\"]" , $ ( "ul.vbtcolor1" ) . first ( ) ) . map ( ( ( index , element ) => {
6767if ( "attribs" in element ) {
6868tagList . push ( createTag ( {
6969id :element . attribs [ "href" ] . replace ( `${ base } /tag/` , "" ) . slice ( 0 , - 1 ) ,
@@ -73,13 +73,13 @@ export class RainOfSnowParser {
7373} ) )
7474const chapterList = this . parseChapterList ( $ , mangaId , base )
7575const mangaObj :Manga = {
76- author :$ ( ".n2 " , items . first ( ) ) . text ( ) ,
76+ author :$ ( "small " , $ ( "ul.vbtcolor1 li" ) . first ( ) ) . text ( ) . trim ( ) ,
7777desc :summary ,
7878id :mangaId ,
79- image :$ ( "div.imgbox img" ) . first ( ) . attr ( "src" ) || "" ,
79+ image :$ ( "img" , $ ( " div.container div.row" ) . first ( ) ) . first ( ) . attr ( "src" ) || "" ,
8080rating :0 ,
8181status :MangaStatus . ONGOING ,
82- titles :[ $ ( "div.container h3 " ) . first ( ) . text ( ) ] ,
82+ titles :[ $ ( "div.text h2 " ) . first ( ) . text ( ) ] ,
8383tags :[ createTagSection ( {
8484id :"1" ,
8585label :"1" ,