-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIx YoungChampion & ComicMedu : more strict chapter CSS (#6356)
* FIx YoungChampion: more strict chapter CSS #6353 * FIx COMICMeDu: extends YoungChampion Fixes #6352 * Update COMICMeDu.mjs
- Loading branch information
Showing
2 changed files
with
7 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,15 @@ | ||
import Connector from '../engine/Connector.mjs'; | ||
import Manga from '../engine/Manga.mjs'; | ||
import YoungChampion from './YoungChampion.mjs'; | ||
|
||
export default class COMICMeDu extends Connector { | ||
export default class COMICMeDu extends YoungChampion { | ||
|
||
constructor() { | ||
super(); | ||
super.id = 'comicmedu'; | ||
super.label = 'COMIC MeDu (こみっくめづ)'; | ||
this.tags = [ 'manga', 'japanese' ]; | ||
this.url = 'http://comic-medu.com'; | ||
|
||
this.path = [ '/wk' ]; | ||
this.queryMangaListCount = 'article div#conMain div.conDoc ul.pagination li'; | ||
this.queryManga = 'article div#conMain div.conDoc div#listB div.listM'; | ||
this.queryMangaLink = 'a'; | ||
this.queryMangaTitle = 'h3.listTtl'; | ||
|
||
this.queryChapters = 'article div#conMain div.conDoc ul.episode li a'; | ||
this.queryShortChapter = 'article div#conMain div.conDoc div.btDetail a.btDetailR'; | ||
|
||
this.queryPages = 'article div.swiper-container div.swiper-wrapper div.swiper-slide source[class*="storyImg"]'; | ||
} | ||
|
||
async _getMangaFromURI(uri) { | ||
let request = new Request(uri, this.requestOptions); | ||
let data = await this.fetchDOM(request, 'head title'); | ||
let id = uri.pathname; | ||
let title = data[0].text.split('|')[0].trim(); | ||
return new Manga(this, id, title); | ||
} | ||
|
||
async _mapMangas(mangas) { | ||
return mangas.map(series => { | ||
return { | ||
id: this.getRootRelativeOrAbsoluteLink(series.querySelector(this.queryMangaLink), this.url), | ||
title: series.querySelector(this.queryMangaTitle).textContent | ||
}; | ||
}); | ||
} | ||
|
||
async _getMangas() { | ||
let uri = new URL(this.url + this.path[0]); | ||
let request = new Request(uri, this.requestOptions); | ||
let seriesPages = await this.fetchDOM(request, this.queryMangaListCount); | ||
let totalPages = seriesPages.length; | ||
let mangas = await this.fetchDOM(request, this.queryManga); | ||
let mangaList = await this._mapMangas(mangas); | ||
for(let page = 2; page <= totalPages; page++) { | ||
uri.searchParams.set('page', page); | ||
request = new Request(uri, this.requestOptions); | ||
mangas = await this._mapMangas(await this.fetchDOM(request, this.queryManga)); | ||
mangaList.push(...mangas); | ||
} | ||
return mangaList; | ||
} | ||
|
||
async _getChapters(manga) { | ||
let uri = new URL(this.url + manga.id); | ||
let request = new Request(uri, this.requestOptions); | ||
let data = await this.fetchDOM(request, this.queryChapters); | ||
if(data.length == 0) { // series is a short story; only one chapter | ||
data = await this.fetchDOM(request, this.queryShortChapter); | ||
data[0].textContent = manga.title; | ||
} | ||
return data.map(element => { | ||
return { | ||
id: this.getRootRelativeOrAbsoluteLink(element, request.url), | ||
title: element.textContent | ||
}; | ||
}); | ||
} | ||
|
||
async _getPages(chapter) { | ||
let uri = new URL(this.url + chapter.id); | ||
let request = new Request(uri, this.requestOptions); | ||
let data = await this.fetchDOM(request, this.queryPages); | ||
return data.map(element => this.getAbsolutePath(element, request.url)); | ||
this.url = 'https://comic-medu.com'; | ||
this.links = { | ||
login: 'https://comic-medu.com/signin' | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters