Skip to content

Commit

Permalink
remove alpha scans, add cosmic scans
Browse files Browse the repository at this point in the history
  • Loading branch information
Yentis committed Nov 11, 2022
1 parent 82970c2 commit 1402d76
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quasar-manga-reader",
"version": "2.20.7",
"version": "2.21.0",
"description": "Manga reader that scrapes manga sites for updates",
"productName": "Manga Reader",
"author": "Yentis#5218",
Expand Down
2 changes: 1 addition & 1 deletion src-cordova/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.cordova.manga.reader" version="2.20.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="org.cordova.manga.reader" version="2.21.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Manga Reader</name>
<description>Manga reader that scrapes manga sites for updates</description>
<author email="[email protected]" href="http://cordova.io">
Expand Down
18 changes: 9 additions & 9 deletions src/classes/sites/asurascans.ts → src/classes/sites/madara.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { requestHandler } from 'src/services/requestService'
import { ContentType } from 'src/enums/contentTypeEnum'
import { parseHtmlFromString, parseNum, titleContainsQuery } from '../../utils/siteUtils'

interface AsuraScansSearch {
interface MadaraSearch {
series: {
all: {
'post_title': string,
Expand All @@ -19,12 +19,12 @@ interface AsuraScansSearch {
}[]
}

class AsuraScansData extends BaseData {
class MadaraData extends BaseData {
chapterUrl?: Element
chapterList?: Element
}

export class AsuraScans extends BaseSite {
export class Madara extends BaseSite {
siteType: SiteType

constructor (siteType: SiteType) {
Expand All @@ -36,11 +36,11 @@ export class AsuraScans extends BaseSite {
}
}

protected getChapterUrl (data: AsuraScansData): string {
protected getChapterUrl (data: MadaraData): string {
return data.chapterUrl?.getAttribute('href') || ''
}

protected getChapterNum (data: AsuraScansData): number {
protected getChapterNum (data: MadaraData): number {
const chapterNum = parseNum(data.chapterNum?.getAttribute('data-num'))
if (chapterNum !== 0) return chapterNum

Expand Down Expand Up @@ -79,7 +79,7 @@ export class AsuraScans extends BaseSite {
const chapterList = doc.querySelectorAll('#chapterlist')[0]
const chapterItem = chapterList?.querySelectorAll('li')[0]

const data = new AsuraScansData(url)
const data = new MadaraData(url)
data.chapter = chapterItem?.querySelectorAll('.chapternum')[0]
data.chapterUrl = chapterItem?.querySelectorAll('a')[0]
data.chapterNum = chapterItem
Expand Down Expand Up @@ -107,7 +107,7 @@ export class AsuraScans extends BaseSite {
}
const response = await requestHandler.sendRequest(request)

const searchData = JSON.parse(response.data) as AsuraScansSearch
const searchData = JSON.parse(response.data) as MadaraSearch
if (!searchData.series) {
return []
}
Expand Down Expand Up @@ -136,8 +136,8 @@ export class AsuraScans extends BaseSite {
return `${this.getUrl()}/manga/mookhyang-the-origin/`
case SiteType.FlameScans:
return `${this.getUrl()}/series/the-way-of-the-househusband/`
case SiteType.AlphaScans:
return `${this.getUrl()}/manga/medical-return/`
case SiteType.CosmicScans:
return `${this.getUrl()}/manga/i-have-max-level-luck/`
case SiteType.LuminousScans:
return `${this.getUrl()}/series/my-office-noonas-story/`
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/TestComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import { LinkingSiteType } from '../enums/linkingSiteEnum'
import { testResetScans } from '../services/test/resetscans'
import { testBiliBiliComics } from '../services/test/bilibilicomics'
import { testKitsu } from '../services/test/kitsu'
import { testAlphaScans } from '../services/test/alphascans'
import { testCosmicScans } from '../services/test/cosmicscans'
import { testCubari } from '../services/test/cubari'
import { testLuminousScans } from 'src/services/test/luminousscans'
import { testTapas } from 'src/services/test/tapas'
Expand Down Expand Up @@ -130,9 +130,6 @@ export default defineComponent({
const testSite = async () => {
switch (selectedSite.value) {
case SiteType.AlphaScans:
await doTest(testAlphaScans)
break
case SiteType.AsuraScans:
await doTest(testAsuraScans)
break
Expand All @@ -148,6 +145,9 @@ export default defineComponent({
case SiteType.CopinComics:
await doTest(testCopinComics)
break
case SiteType.CosmicScans:
await doTest(testCosmicScans)
break
case SiteType.Cubari:
await doTest(testCubari)
break
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useManga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function useManga (curUrl: string) {
updateMangaShouldUpdate
} = useMangaList()
const manga = computed(() => {
return $store.state.reader.mangaMap.get(curUrl) || new Manga(curUrl, SiteType.AlphaScans)
return $store.state.reader.mangaMap.get(curUrl) || new Manga(curUrl, SiteType.AsuraScans)
})

const url = computed(() => manga.value.url)
Expand Down
4 changes: 2 additions & 2 deletions src/enums/siteEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export enum SiteType {
FlameScans = 'flamescans.org',
ResetScans = 'reset-scans.com',
BiliBiliComics = 'bilibilicomics.com',
AlphaScans = 'alpha-scans.org',
CosmicScans = 'cosmicscans.com',
Cubari = 'cubari.moe',
LuminousScans = 'luminousscans.com',
Tapas = 'tapas.io',
Expand Down Expand Up @@ -51,7 +51,7 @@ export enum SiteName {
'flamescans.org' = 'Flame Scans',
'reset-scans.com' = 'Reset Scans',
'bilibilicomics.com' = 'BiliBili Comics',
'alpha-scans.org' = 'Alpha Scans',
'cosmicscans.com' = 'Cosmic Scans',
'cubari.moe' = 'Cubari / Guya',
'luminousscans.com' = 'Luminous Scans',
'tapas.io' = 'Tapas',
Expand Down
12 changes: 6 additions & 6 deletions src/services/siteService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
BaseSite
} from '../classes/sites/baseSite'
import {
AsuraScans
} from '../classes/sites/asurascans'
Madara
} from '../classes/sites/madara'
import {
Mangago
} from '../classes/sites/mangago'
Expand Down Expand Up @@ -64,20 +64,20 @@ const siteMap = new Map<string, BaseSite>([
[SiteType.LeviatanScans, new WordPress(SiteType.LeviatanScans)],
[SiteType.HiperDEX, new WordPress(SiteType.HiperDEX)],
[SiteType.ReaperScans, new ReaperScans()],
[SiteType.AsuraScans, new AsuraScans(SiteType.AsuraScans)],
[SiteType.AsuraScans, new Madara(SiteType.AsuraScans)],
[SiteType.ManhwaClub, new ManhwaClub()],
[SiteType.MangaTx, new WordPress(SiteType.MangaTx)],
[SiteType.Mangago, new Mangago()],
[SiteType.SleepingKnightScans, new WordPress(SiteType.SleepingKnightScans)],
[SiteType.ZeroScans, new ZeroScans()],
[SiteType.LynxScans, new Genkan(SiteType.LynxScans)],
[SiteType.Batoto, new Batoto()],
[SiteType.FlameScans, new AsuraScans(SiteType.FlameScans)],
[SiteType.FlameScans, new Madara(SiteType.FlameScans)],
[SiteType.ResetScans, new WordPress(SiteType.ResetScans)],
[SiteType.BiliBiliComics, new BiliBiliComics()],
[SiteType.AlphaScans, new AsuraScans(SiteType.AlphaScans)],
[SiteType.CosmicScans, new Madara(SiteType.CosmicScans)],
[SiteType.Cubari, new Cubari()],
[SiteType.LuminousScans, new AsuraScans(SiteType.LuminousScans)],
[SiteType.LuminousScans, new Madara(SiteType.LuminousScans)],
[SiteType.Tapas, new Tapas()],
[SiteType.CopinComics, new CopinComics()],
[SiteType.Comikey, new Comikey()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { SiteType } from 'src/enums/siteEnum'
import { getMangaInfo, getSite, searchManga } from '../siteService'
import { mangaEqual, searchValid } from '../testService'

const SITE_TYPE = SiteType.AlphaScans
const QUERY = 'medical return'
const SITE_TYPE = SiteType.CosmicScans
const QUERY = 'i have max level luck'

export async function testAlphaScans (): Promise<void> {
export async function testCosmicScans (): Promise<void> {
const site = getSite(SITE_TYPE)
if (!site) throw Error('Site not found')

Expand All @@ -19,22 +19,22 @@ export async function testAlphaScans (): Promise<void> {
async function readUrl (site: BaseSite): Promise<void> {
const manga = await getMangaInfo(site.getTestUrl(), SITE_TYPE)
const desired = new Manga(site.getTestUrl(), SITE_TYPE)
desired.chapter = 'Chapter 148 (END)'
desired.image = 'https://i2.wp.com/alpha-scans.org/wp-content/uploads/2021/07/Medical-Return-Cover.gif'
desired.title = 'Medical Return'
desired.chapterUrl = 'https://alpha-scans.org/medical-return-chapter-148-end/'
desired.chapterNum = 148
desired.chapterDate = moment('28/01/2022', 'DD/MM/YYYY').fromNow()
desired.chapter = 'Chapter 9'
desired.image = 'https://cosmicscans.com/wp-content/uploads/2022/06/i-have-max-level-luck.jpeg'
desired.title = 'I Have Max Level Luck'
desired.chapterUrl = 'https://cosmicscans.com/i-have-max-level-luck-chapter-9/'
desired.chapterNum = 9
desired.chapterDate = moment('25/06/2022', 'DD/MM/YYYY').fromNow()

mangaEqual(manga, desired)
}

async function search (site: BaseSite): Promise<void> {
const results = await searchManga(QUERY, SITE_TYPE)
const desired = new Manga(site.getTestUrl(), SITE_TYPE)
desired.image = 'https://i2.wp.com/alpha-scans.org/wp-content/uploads/2021/07/Medical-Return-Cover.gif?h=80'
desired.chapter = '148 (END)'
desired.url = 'https://alpha-scans.org/manga/medical-return/'
desired.image = 'https://i3.wp.com/cosmicscans.com/wp-content/uploads/2022/06/i-have-max-level-luck.jpeg?resize=65,85'
desired.chapter = '9'
desired.url = 'https://cosmicscans.com/manga/i-have-max-level-luck/'

return searchValid(results, desired, QUERY)
}
6 changes: 3 additions & 3 deletions src/services/testService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { testWebtoons } from './test/webtoons'
import { testZeroScans } from './test/zeroscans'
import { testBiliBiliComics } from './test/bilibilicomics'
import { testKitsu } from './test/kitsu'
import { testAlphaScans } from './test/alphascans'
import { testCosmicScans } from './test/cosmicscans'
import { testCubari } from './test/cubari'
import { testLuminousScans } from './test/luminousscans'
import { testTapas } from './test/tapas'
Expand All @@ -37,8 +37,8 @@ export default async function testAll (
const promises: Promise<void>[] = []
const errors: { site: SiteType | LinkingSiteType, error: unknown }[] = []

promises.push(testAlphaScans().catch((error) => {
errors.push({ site: SiteType.AlphaScans, error: error })
promises.push(testCosmicScans().catch((error) => {
errors.push({ site: SiteType.CosmicScans, error: error })
}))
promises.push(testAsuraScans().catch((error) => {
errors.push({ site: SiteType.AsuraScans, error: error })
Expand Down

0 comments on commit 1402d76

Please sign in to comment.