Skip to content

Commit

Permalink
FIx welovemanga.one: getting pages (#6715)
Browse files Browse the repository at this point in the history
Fixes #6711
  • Loading branch information
MikeZeDev authored Mar 2, 2024
1 parent 4fb1b74 commit 6de4ffa
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/web/mjs/connectors/LoveHug.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,10 @@ export default class WeLoveManga extends FlatManga {

async _getPages(chapter) {
const uri = new URL(chapter.id, this.url);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, this.queryPages);
return data.map(element => {
const link = [ ...element.attributes]
.filter(attribute => !['src', 'class', 'alt'].includes(attribute.name))
.map(attribute => {
try {
return atob(attribute.value.trim());
} catch(_) {
return attribute.value.trim();
}
})
.find(value => {
return /^http/.test(value);
});
return this.createConnectorURI(this.getAbsolutePath(link || element, request.url));
});
let request = new Request(uri, this.requestOptions);
const chapterid = (await this.fetchDOM(request, 'input#chapter'))[0].value;
request = new Request(new URL(`/app/manga/controllers/cont.listImg.php?cid=${chapterid}`, this.url), this.requestOptions);
const nodes = await this.fetchDOM(request, 'source.chapter-img:not([alt*="nicoscan"])');
return nodes.map(image => this.createConnectorURI(image.dataset.original.replace(/\n/g, '')));
}
}

0 comments on commit 6de4ffa

Please sign in to comment.