Skip to content

Commit

Permalink
Fix TopToon : update CSS selectors (#6906)
Browse files Browse the repository at this point in the history
* Fix TopToon : update CSS selectors

Fixes #6905

* Update TopToon.mjs

* Update TopToon.mjs

* attempt to fix lint error

* dont use optional chaining

optional chaining doesnt work in stable build because electron version is too old
  • Loading branch information
MikeZeDev authored Mar 31, 2024
1 parent bfe706d commit 63188f4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/web/mjs/connectors/TopToon.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export default class TopToon extends Connector {
}
async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const data = await this.fetchDOM(request, 'div.bnr_episode_info p.tit_toon');
const data = await this.fetchDOM(request, 'div.ep_comic_info span.comic_tit span');
return new Manga(this, uri.pathname, data[0].textContent.trim());
}

async _getMangas() {
const req = new Request('https://toptoon.com/hashtag', this.requestOptions);
const req = new Request(new URL('/hashtag', this.url), this.requestOptions);
const api = await this.fetchRegex(req, /fileUrl\s*:\s*'([^']+)'/g);
const request = new Request(api[0], this.requestOptions);
const data = await this.fetchJSON(request);
Expand All @@ -34,11 +34,11 @@ export default class TopToon extends Connector {

async _getChapters(manga) {
const request = new Request(new URL(manga.id, this.url), this.requestOptions);
const data = await this.fetchDOM(request, 'div.episode_list ul a.episode-items');
const data = await this.fetchDOM(request, 'div.eplist ul a.episode-items');
return data.map(element => {
let title = element.querySelector('p.episode_title').textContent.trim();
const subtitle = element.querySelector('p.episode_stitle');
title += subtitle ? ' - ' + subtitle.textContent.trim() : '';
let title = element.querySelector('p.ep_title').textContent.trim();
const subtitle = element.querySelector('p.ep_stitle');
title += subtitle && subtitle.textContent.trim() != '' ? ' - ' + subtitle.textContent.trim() : '';
return {
id: `/comic/ep_view/${element.dataset.comicId}/${element.dataset.episodeId}`,
title: title
Expand All @@ -51,4 +51,4 @@ export default class TopToon extends Connector {
const data = await this.fetchDOM(request, 'div#viewerContentsWrap source.document_img');
return data.map(element => this.getAbsolutePath(element.dataset.src || element, request.url));
}
}
}

0 comments on commit 63188f4

Please sign in to comment.