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

[Bato.to] Connector not working #2413 #2455

Merged
merged 4 commits into from
Oct 19, 2020
Merged
Changes from 1 commit
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
9 changes: 5 additions & 4 deletions src/web/mjs/connectors/Batoto.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ export default class Batoto extends AnyACG {
this.queryMangaTitle = 'div#series-page div.title-set';
this.queryMangaTitleText = 'h3.item-title a';
this.queryMangaTitleFlag = 'span.item-flag';
this.queryMangaPages = 'nav.pager ul.pagination li.page-item:nth-last-child(2) a.page-link';
this.queryMangaPages = 'nav.d-none ul.pagination li.page-item:nth-last-child(2) a.page-link';
this.queryMangas = 'div#series-list div.item-text';
this.queryMangaLink = 'a.item-title';
this.queryMangaFlag = 'span.item-flag';
this.queryChapters = 'div.chapter-list div.main a.chapt';
this.queryPages = /images\s*=\s*(\{.*\})\s*;/g;
this.queryChapters = 'div.episode-list div.main a.visited';
this.queryPages = /images\s*=\s*(\[.*\])\s*;/g;
}

async _getPages(chapter) {
let request = new Request(new URL(chapter.id, this.url), this.requestOptions);
let data = await this.fetchRegex(request, this.queryPages);
return Object.values(JSON.parse(data[0]));
data = Object.values(JSON.parse(data[0]));
return data.map(element => this.getAbsolutePath(`https:${element}`, request.url));
Copy link
Contributor

@ronny1982 ronny1982 Oct 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use URL constructor to build valid UVStrings with request.url as base (otherwise it will fail if e.g. element already starts with https)
data.map(element => new URL(element, request.url).href)

}
}