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 Tapas: improve manga list #6300

Merged
merged 2 commits into from
Oct 8, 2023
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
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) ];
}

}
}