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 klm website change #7105

Merged
merged 5 commits into from
Jun 1, 2024
Merged
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
16 changes: 12 additions & 4 deletions src/web/mjs/connectors/KissAway.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ export default class KissAway extends FlatManga {
this.requestOptions.headers.set('x-referer', this.url);
}

generateRandomStr(length) {
const charmap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let result ='';
for (let o = 0; o < length; o++) result += charmap.charAt(Math.floor(Math.random() * charmap.length));
return result;
}

async _getChapters(manga) {
const randomStr = this.generateRandomStr(25);
const script = `
new Promise(async resolve => {
const uri = new URL('app/manga/controllers/cont.listChapter.php', window.location.origin);
const uri = new URL('${randomStr}.lstc', window.location.origin);
uri.searchParams.set('slug', dataL);
const response = await fetch(uri);
data = await response.text();
Expand All @@ -37,21 +45,21 @@ export default class KissAway extends FlatManga {

async _getPages(chapter) {
const uri = new URL(chapter.id, this.url);
const randomStr = this.generateRandomStr(30);
const script = `
new Promise(async resolve => {
const chapId = document.querySelector('input#chapter').value;
const uri = new URL('app/manga/controllers/cont.listImg.php', window.location.origin);
const uri = new URL('${randomStr}.iog', window.location.origin);
uri.searchParams.set('cid', chapId);
const response = await fetch(uri);
const data = await response.text();
const dom = new DOMParser().parseFromString(data, "text/html");
const nodes = [...dom.querySelectorAll('img.chapter-img')];
resolve(nodes.map(picture => picture.src));
resolve(nodes.map(picture => picture.src).filter(image => !image.match(/olimposcan/)));
});
`;
const request = new Request(uri, this.requestOptions);
const data = await Engine.Request.fetchUI(request, script);
return data.map(link => this.createConnectorURI(link));
}

}
Loading