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.io connection #7180

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Changes from 2 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
18 changes: 10 additions & 8 deletions src/web/mjs/connectors/Tapas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ export default class Tapas extends Connector {
}

async _getMangaFromURI(uri) {
let request = new Request(uri, this.requestOptions);
let data = await this.fetchDOM(request, 'div.info a.title');
let id = uri.pathname;
let title = data[0].textContent.trim();
return new Manga(this, id, title);
let spliced_url = (await this.fetchDOM(new Request(uri), 'meta[property="al:android:url"]'))[0].content.split('/')
// title can be in two formats: tapas/series/<series_name> or tapas/series/<series_name>/info
let seriesId = (spliced_url[spliced_url.length - 1] == 'info' ? spliced_url[spliced_url.length-2] : spliced_url.pop())
Asriel2137 marked this conversation as resolved.
Show resolved Hide resolved
let data = (await this.fetchJSON(new Request(new URL(`${this.url}/series/${seriesId}?`, this.URI), {
headers: {
Accept: 'application/json, text/javascript, */*;',
'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
}))).data;
return new Manga(this, data.id.toString(), data.title.trim());
}

async _getMangas() {
Expand Down Expand Up @@ -47,8 +52,6 @@ export default class Tapas extends Connector {
}

async _getChapters(manga) {
let chapterList = [];

let request = new Request(new URL(`${this.url}/series/${manga.id}/episodes?max_limit=9999`), this.requestOptions);
let response = await this.fetchJSON(request);

Expand Down Expand Up @@ -76,7 +79,6 @@ export default class Tapas extends Connector {
}

async _getPagesNovel(request) {
// Not updated since hakuneko doesn't support novels anyways.
let darkmode = Engine.Settings.NovelColorProfile();
let script = `
new Promise((resolve, reject) => {
Expand Down
Loading