Skip to content

Commit

Permalink
AsuraScans | Implement part of "auto migration" when asura temp redir…
Browse files Browse the repository at this point in the history
…ects
  • Loading branch information
Seyden committed Jul 28, 2024
1 parent fce8a4c commit 99139b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/AsuraScans/AsuraScans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ASURASCANS_DOMAIN = 'https://asuracomic.net'
const ASURASCANS_API_DOMAIN = 'https://gg.asuracomic.net'

export const AsuraScansInfo: SourceInfo = {
version: '4.1.2',
version: '4.1.3',
name: 'AsuraScans',
description: 'Extension that pulls manga from AsuraScans',
author: 'Seyden',
Expand Down Expand Up @@ -292,7 +292,7 @@ export class AsuraScans implements ChapterProviding, HomePageSectionsProviding,

async getMangaDetails(mangaId: string): Promise<SourceManga> {
const data = await this.getMangaRequest(mangaId)
return this.parser.parseMangaDetails(data, mangaId, this)
return await this.parser.parseMangaDetails(data, mangaId, this)
}

async getChapters(mangaId: string): Promise<Chapter[]> {
Expand Down
7 changes: 6 additions & 1 deletion src/AsuraScans/AsuraScansParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import entities = require('entities')

export class AsuraScansParser {
parseMangaDetails(data: string, mangaId: string, source: any): SourceManga {
async parseMangaDetails(data: string, mangaId: string, source: any): Promise<SourceManga> {
const obj = extractMangaData(data.replace(/\\"/g, '"').replace(/\\\\"/g, '\\"'), "comic") ?? ''
if (obj == '') {
throw new Error(`Failed to parse comic object for manga ${mangaId}`) // If null, throw error, else parse data to json.
Expand All @@ -33,6 +33,11 @@ export class AsuraScansParser {
const covers = [comicObj.comic.cover]
const description = this.decodeHTMLEntity($('span.font-medium').text().trim().replace(/\\r\\n/gm, '\n'))
const rating = comicObj.comic.rating

const slug = comicObj.comic.slug?.trim()
if (slug) {
await source.setMangaSlug(mangaId, `series/${slug}`)
}

const rawStatus = comicObj.comic.status.name.trim()
let status
Expand Down

0 comments on commit 99139b4

Please sign in to comment.