Skip to content

Commit 4928db1

Browse files
authored
Fixed MangaCatalog all extensions not working (#164)
1 parent ada2982 commit 4928db1

4 files changed

Lines changed: 11 additions & 39 deletions

File tree

src/MangaCatalog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
SourceBaseData
2121
} from './MangaCatalogInterface'
2222

23-
const BASE_VERSION = '1.1.1'
23+
const BASE_VERSION = '1.1.2'
2424

2525
export const getExportVersion = (EXTENSION_VERSION: string): string => {
2626
// Thanks to https://github.com/TheNetsky/

src/MangaCatalogParser.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,18 @@ export class Parser {
7272

7373
parseChapterDetails = ($: CheerioStatic, mangaId: string, chapterId: string, source: any): ChapterDetails => {
7474
const pages: string[] = []
75-
7675
for (const img of $(source.chapterImageSelector, source.chapterImagesArraySelector).toArray()) {
77-
const image = img.attribs['src']
76+
let image = img.attribs['data-src']
77+
if (!image) {
78+
image = img.attribs['src']
79+
}
7880
if (!image) continue
79-
pages.push(image.trim())
81+
// Sometimes random url param strings end up getting appended, so we are making
82+
// sure that this is an image link
83+
const match = image.match(/(https?:\/\/[^\s]+?\.(?:jpe?g|png|webp|gif|svg))/i);
84+
if (match) {
85+
pages.push(match[0])
86+
}
8087
}
8188

8289
const chapterDetails = App.createChapterDetails({

src/ReadBerserk/ReadBerserk.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from '../MangaCatalog'
1111

1212
import { SourceBase } from '../MangaCatalogInterface'
13-
import { ReadBerserkParser } from './ReadBerserkParser'
1413

1514
const DOMAIN = 'https://readberserk.com'
1615

@@ -29,11 +28,6 @@ export const ReadBerserkInfo: SourceInfo = {
2928

3029
export class ReadBerserk extends MangaCatalog {
3130

32-
constructor(cheerio: CheerioAPI) {
33-
super(cheerio)
34-
this.parser = new ReadBerserkParser()
35-
}
36-
3731
baseUrl: string = DOMAIN
3832

3933
iconUrl = 'https://i0.wp.com/readberserk.com/wp-content/uploads/2017/06/berserk-1.jpg'

src/ReadBerserk/ReadBerserkParser.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)