Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX & ADD - Delitoon Update #5225

Merged
merged 3 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/web/mjs/connectors/Bontoon.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Delitoon from './Delitoon.mjs';

export default class Bontoon extends Delitoon {
constructor() {
super();
super.id = 'bontoon';
super.label = 'Bontoon';
this.tags = [ 'webtoon', 'french', 'hentai', 'yaoi' ];
this.url = 'https://www.bontoon.com';
this.links = {
login: 'https://www.bontoon.com/user/login'
};
this.requestOptions.headers.set('x-balcony-id', 'BONTOON_COM');
this.requestOptions.headers.set('x-referer', this.url);
}
get icon() {
return '/img/connectors/delitoon';
}
}
102 changes: 56 additions & 46 deletions src/web/mjs/connectors/Delitoon.mjs
Original file line number Diff line number Diff line change
@@ -1,66 +1,76 @@
import Connector from '../engine/Connector.mjs';
import Manga from '../engine/Manga.mjs';

export default class Delitoon extends Connector {

constructor() {
super();
super.id = 'delitoon';
super.label = 'Delitoon';
this.tags = [ 'webtoon', 'french' ];
this.url = 'https://www.delitoon.com';
this.links = {
login: 'https://www.delitoon.com/connexion'
login: 'https://www.delitoon.com/user/login'
};
this.requestOptions.headers.set('x-balcony-id', 'DELITOON_COM');
this.requestOptions.headers.set('x-balcony-timeZone', 'Europe/Paris');
this.requestOptions.headers.set('x-platform', 'WEB');
this.requestOptions.headers.set('x-referer', this.url);
}

async _getMangaFromURI(uri) {
let request = new Request(uri, this.requestOptions);
let data = await this.fetchDOM(request, 'div.serie-page div.container div.informations-part1.detail div div.bloc-left h2');
return new Manga(this, uri.pathname, data[0].textContent.trim());
const mangaid = uri.href.match(/\/detail\/(\S+)/)[1];
const req = new URL('/api/balcony-api/contents/'+mangaid, this.url);
req.searchParams.set('isNotLoginAdult', 'true');
const request = new Request(req, this.requestOptions);
const data = await this.fetchJSON(request);
return new Manga(this, mangaid, data.data.title.trim());
}

async _getMangas() {
let mangaList = [];
let genres = ['Romance', 'BL', 'Drama', 'Sentimental', 'Historique', 'Slice%20of%20Life', 'Fantastique', 'Comédie', 'Thriller', 'Action', 'Aventure', 'SF'];
for(let genre of genres) {
let mangas = await this._getMangasFromPage(genre);
mangaList.push(...mangas);
}
return mangaList;
}

async _getMangasFromPage(page) {
let request = new Request(this.url + '/genres/' + page, this.requestOptions);
let data = await this.fetchDOM(request, 'div.genres-page div.content ul li');
return data.filter(element => element.querySelector('h3'))
.map(element => {
let title = element.querySelector('div.container-infos h3').textContent.trim();
let link = element.querySelector('li a');
return {
id: this.getRootRelativeOrAbsoluteLink(link, request.url),
title: title
};
});
const uri = new URL('/api/balcony-api-v2/contents/search', this.url);
uri.searchParams.set('searchText', '');
uri.searchParams.set('isCheckDevice', 'true');
uri.searchParams.set('isIncludeAdult', 'true');
uri.searchParams.set('contentsThumbnailType', 'MAIN');
const request = new Request(uri, this.requestOptions);
const data = await this.fetchJSON(request);
return data.data.map(element => {
return {
id : element.alias,
title : element.title.trim()
};
});
}

async _getChapters(manga) {
let request = new Request(this.url + manga.id, this.requestOptions);
let data = await this.fetchDOM(request, 'div.container div.episodes div.title ul#tab1 li');
return data.filter(element => element.querySelector('div.number'))
.map(element => {
let title = element.querySelector('div.container-infos div.bloc-infos div.number').textContent.trim();
let link = element.querySelector('li a');
return {
id: this.getRootRelativeOrAbsoluteLink(link, request.url),
title: 'Episode ' + title
};
}).reverse();
const uri = new URL('/api/balcony-api/contents/'+manga.id, this.url);
uri.searchParams.set('isNotLoginAdult', 'true');
const request = new Request(uri, this.requestOptions);
const data = await this.fetchJSON(request);
return data.data.episodes.map(element => {
let title = '';
try{
let chapnum = parseInt(element.title);
title = 'Chapter '+ chapnum;
} catch (error) {
title = element.title.trim();
}
title += element.subtitle ? element.subTitle.trim() : '';
return {
id : element.alias,
title : title,
};
}).reverse();
}

async _getPages(chapter) {
let request = new Request(this.url + chapter.id, this.requestOptions);
let data = await this.fetchDOM(request, 'div.episode div#bck-color div.main div#image-container source');
return data.map(element => this.getAbsolutePath(element, request.url));
const uri = new URL('/api/balcony-api/contents/'+chapter.manga.id+'/'+chapter.id, this.url);
uri.searchParams.set('isNotLoginAdult', 'true');
const request = new Request(uri, this.requestOptions);
const data = await this.fetchJSON(request);
if (data.result == 'ERROR') {
switch (data.error.code) {
case 'NOT_LOGIN_USER':
throw new Error('You must be logged/have paid to view this chapter !');
default:
throw new Error('Unknown error : '+ data.error.code);
}
}
return data.data.images.map(element => element.imagePath);
}
}
}
15 changes: 3 additions & 12 deletions src/web/mjs/connectors/DelitoonDE.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,9 @@ export default class DelitoonDE extends Delitoon {
this.tags = [ 'webtoon', 'german' ];
this.url = 'https://www.delitoon.de';
this.links = {
login: 'https://www.delitoon.de/connexion'
login: 'https://www.delitoon.de/user/login'
};
this.requestOptions.headers.set('x-balcony-id', 'DELITOON_DE');
this.requestOptions.headers.set('x-referer', this.url);
}

async _getMangas() {
let mangaList = [];
let genres = ['Romance', 'Boys%20Love', 'Drama', 'Sentimental', 'Historisch', 'Slice%20of%20Life', 'Fantasy', 'Komödie', 'Thriller', 'Action', 'Abenteuer', 'Sci-Fi'];
for(let genre of genres) {
let mangas = await this._getMangasFromPage(genre);
mangaList.push(...mangas);
}
return mangaList;
}

}
19 changes: 19 additions & 0 deletions src/web/mjs/connectors/Delitoonx.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Delitoon from './Delitoon.mjs';

export default class Delitoonx extends Delitoon {
constructor() {
super();
super.id = 'delitoonx';
super.label = 'Delitoon X';
this.tags = [ 'webtoon', 'french', 'hentai' ];
this.url = 'https://www.delitoonx.com';
this.links = {
login: 'https://www.delitoonx.com/user/login'
};
this.requestOptions.headers.set('x-balcony-id', 'DELITOONX_COM');
this.requestOptions.headers.set('x-referer', this.url);
}
get icon() {
return '/img/connectors/delitoon';
}
}