Skip to content

Commit

Permalink
Update Hentai-chan (#5422)
Browse files Browse the repository at this point in the history
* Fix url
* Made Mangachan more like a template at its the template for Hentai-chan
* Fixes #5357
  • Loading branch information
MikeZeDev authored and Sheepux committed Mar 26, 2023
1 parent 3518b22 commit 3a23060
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
20 changes: 17 additions & 3 deletions src/web/mjs/connectors/HenChan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,23 @@ export default class HenChan extends MangaChan {
super.id = 'henchan';
super.label = 'Хентай-тян! (Hentai-chan)';
this.tags = [ 'hentai', 'russian' ];
this.url = 'https://henchan.pro';

this.url = 'https://y.hentaichan.live';
this.path = '/manga/new';
this.queryChapters = 'div.extaraNavi p.extra_off:last-of-type a';
this.queryChapters = 'div#manga_images a';
this.queryPages = 'data.fullimg';
}

async _getChapters(manga) {
const uri = new URL(manga.id, this.url);
const request = new Request(uri, this.requestOptions );
const data = await this.fetchDOM(request, this.queryChapters );
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
title: element.title.replace(manga.title, '').trim().replace('Читать онлайн', manga.title),
language: 'ru'
};
});
}

}
12 changes: 8 additions & 4 deletions src/web/mjs/connectors/MangaChan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default class MangaChan extends Connector {
super.label = 'Манга-тян (Manga-chan)';
this.tags = [ 'manga', 'russian' ];
this.url = 'https://manga-chan.me';
this.path = '/catalog';
this.queryChapters = 'table.table_cha tr td div.manga2 a';
this.queryPages = 'fullimg';

}

async _getMangaFromURI(uri) {
Expand All @@ -21,7 +25,7 @@ export default class MangaChan extends Connector {

async _getMangas() {
const mangaList = [];
const request = new Request(new URL('/catalog', this.url), this.requestOptions);
const request = new Request(new URL(this.path, this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div#pagination span a:last-of-type');
const pageCount = parseInt(data[0].text.trim());
for(let page = 0; page <= pageCount; page++) {
Expand All @@ -32,7 +36,7 @@ export default class MangaChan extends Connector {
}

async _getMangasFromPage(page) {
const uri = new URL('/catalog', this.url);
const uri = new URL(this.path, this.url);
uri.searchParams.set('offset', page * 20);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'div#content div.content_row div.manga_row1 h2 a.title_link', 3);
Expand All @@ -47,7 +51,7 @@ export default class MangaChan extends Connector {
async _getChapters(manga) {
const uri = new URL(manga.id, this.url);
const request = new Request(uri, this.requestOptions );
const data = await this.fetchDOM(request, 'table.table_cha tr td div.manga2 a');
const data = await this.fetchDOM(request, this.queryChapters );
return data.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element, this.url),
Expand All @@ -59,7 +63,7 @@ export default class MangaChan extends Connector {

async _getPages(chapter) {
const script = `
new Promise(resolve => resolve(fullimg));
new Promise(resolve => resolve(${this.queryPages}));
`;
const uri = new URL(chapter.id, this.url);
const request = new Request(uri, this.requestOptions );
Expand Down

0 comments on commit 3a23060

Please sign in to comment.