Skip to content

Commit

Permalink
FIX : mkzhan. Fix getting pictures
Browse files Browse the repository at this point in the history
* get chapters using their api
* get pictures using their api
  • Loading branch information
MikeZeDev authored Jul 1, 2023
1 parent 54f80c3 commit 857193d
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/web/mjs/connectors/mkzhan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,28 @@ export default class mkzhan extends MH {
this.path = '/category/?page=%PAGE%';
this.queryMangasPageCount = 'div#Pagination a:nth-last-child(2)';
this.queryMangas = 'div.cate-comic-list div.common-comic-item a.cover';
this.queryChapter = 'a.j-chapter-link';
this.queryMangaTitle = 'div.de-info__box p.comic-title ';
this.queryPages = 'div.rd-article-wr div.rd-article__pic source';
this.apiUrl = 'https://comic.mkzcdn.com';
}

async _getChapters(manga) {
let request = new Request(new URL(manga.id, this.url), this.requestOptions);
let data = await this.fetchDOM(request, this.queryChapter);
return data.map(element => {
const mangaId = manga.id.match(/\/(\d+)\/$/)[1];
const request = new Request(new URL(`/chapter/v1/?comic_id=${mangaId}`, this.apiUrl), this.requestOptions);
const data = await this.fetchJSON(request);
return data.code == 200 ? data.data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element.dataset.hreflink, this.url),
title: element.textContent.trim()
id: element.chapter_id,
title: element.title.trim()
};
});
}) : [];
}
}

async _getPages(chapter) {
const mangaId = chapter.manga.id.match(/\/(\d+)\/$/)[1];
const request = new Request(new URL(`/chapter/content/v1/?chapter_id=${chapter.id}&comic_id=${mangaId}&format=1&quality=1&type=1`, this.apiUrl), this.requestOptions);
const data = await this.fetchJSON(request);
return data.code == 200 ? data.data.page.map(element => element.image) : [];

}

}

0 comments on commit 857193d

Please sign in to comment.