Skip to content

Commit

Permalink
FIX Tapas: improve manga list (#6300)
Browse files Browse the repository at this point in the history
* Fix Tapas: extract mangatitle from dataset

* tapas : use json to get mangas

better that fetching page again
  • Loading branch information
MikeZeDev authored Oct 8, 2023
1 parent 1de6a4f commit b43e619
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/web/mjs/connectors/Tapas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ export default class Tapas extends Connector {
}

async _getMangasFromPage(page) {
let uri = new URL('/comics', this.url);
const uri = new URL('/comics', this.url);
uri.searchParams.set('b', 'ALL');
uri.searchParams.set('g', 0);
uri.searchParams.set('pageNumber', page);
//uri.searchParams.set('pageSize', 20);
let request = new Request(uri, this.requestOptions);
let data = await this.fetchDOM(request, 'div.section__body ul.content__list li.list__item a.thumb');
return data.map(element => {
const request = new Request(uri, this.requestOptions);
request.headers.set('Accept', 'application/json, text/javascript, */*;');

const data = await this.fetchJSON(request, this.requestOptions);
const dom = new DOMParser().parseFromString(data.data.body, 'text/html');
const nodes = [...dom.querySelectorAll('li.list__item a.thumb')];

return nodes.map(element => {
return {
id: this.getRootRelativeOrAbsoluteLink(element.pathname, this.url),
title: element.querySelector('source').attributes.getNamedItem('alt').value.trim()
title: element.dataset.tiaraEventMetaSeries.trim()
};
});
}
Expand Down Expand Up @@ -127,4 +132,4 @@ export default class Tapas extends Connector {
return [ await Engine.Request.fetchUI(request, script, 30000, true) ];
}

}
}

0 comments on commit b43e619

Please sign in to comment.