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

Futabanet: filter app chapters & accept futabanex #7098

Closed
wants to merge 2 commits into from
Closed
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
41 changes: 32 additions & 9 deletions src/web/mjs/connectors/Futabanet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default class Futabanet extends SpeedBinb {
this.url = 'https://gaugau.futabanet.jp';
}

canHandleURI(uri) {
return uri.origin.replace('futabanex', 'futabanet') === this.url;
}

async _getMangaFromURI(uri) {
let request = new Request(uri, this.requestOptions);
let data = await this.fetchDOM(request, 'div.works__grid div.list__text div.mbOff h1');
Expand Down Expand Up @@ -42,14 +46,33 @@ export default class Futabanet extends SpeedBinb {
async _getChapters(manga) {
let request = new Request(new URL(manga.id+'/episodes', this.url), this.requestOptions);
let data = await this.fetchDOM(request, 'div.episode__grid a');
return data.map(element => {
const epnum = element.querySelector('.episode__num').textContent.trim();
const title = element.querySelector('.episode__title').textContent.trim();

return {
id: this.getRootRelativeOrAbsoluteLink(element, request.url),
title: title ? [epnum, title].join(' - ') : epnum,
};
});
return data
.filter(element => !element.pathname.endsWith('/app'))
.map(element => {
const epnum = element.querySelector('.episode__num').textContent.trim();
const title = element.querySelector('.episode__title').textContent.trim();

return {
id: this.getRootRelativeOrAbsoluteLink(element, request.url),
title: title ? [epnum, title].join(' - ') : epnum,
};
});
}

async _getPageList(manga, chapter, callback) {
try {
let pages = [];
const url = new URL(chapter.id, this.baseURL || this.url);
const request = new Request( url, this.requestOptions );
const data = await this.fetchDOM( request, 'div.works_tateyomi__img source' );
if (data && data.length > 0) {
pages = data.map(element => element.getAttribute('src'));
callback(null, pages);
} else await super._getPageList( manga, chapter, callback );

} catch(error) {
console.error(error, chapter);
callback(error, undefined);
}
}
}
Loading