Skip to content

Commit

Permalink
improve error notifications, fix asura test, only show free chapters …
Browse files Browse the repository at this point in the history
…comikey, fix manganato search, fix leviatanscans, remove genkan.io
  • Loading branch information
Yentis committed Sep 15, 2022
1 parent 0e79c72 commit dda3d4b
Show file tree
Hide file tree
Showing 31 changed files with 262 additions and 354 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.2",
"version": "2.20.3",
"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.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="org.cordova.manga.reader" version="2.20.3" 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
2 changes: 1 addition & 1 deletion src/classes/notifyOptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class NotifyOptions {
message: Error | string
type = 'negative'
type: 'positive' | 'negative' | 'warning' | 'info' | 'ongoing' = 'negative'
timeout: number | undefined = undefined
position: 'bottom' | 'top' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left' | 'right' | 'center' | undefined = undefined
closeBtn: boolean | string = false
Expand Down
2 changes: 1 addition & 1 deletion src/classes/sites/asurascans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class AsuraScans extends BaseSite {
getTestUrl () : string {
switch (this.siteType) {
case SiteType.AsuraScans:
return `${this.getUrl()}/comics/mookhyang-the-origin/`
return `${this.getUrl()}/manga/mookhyang-the-origin/`
case SiteType.FlameScans:
return `${this.getUrl()}/series/the-way-of-the-househusband/`
case SiteType.AlphaScans:
Expand Down
3 changes: 2 additions & 1 deletion src/classes/sites/comikey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export class Comikey extends BaseSite {
if (!rssUrl) return Error('Could not find RSS url')

const rssRequest: HttpRequest = { method: 'GET', url: `${this.getUrl()}${rssUrl}` }
const data = await getRssData(url, rssRequest)
// Latest chapter can't be read for free
const data = await getRssData({ url, request: rssRequest, index: 1 })
data.image = doc.querySelectorAll('.item-preview img')[0]

return this.buildManga(data)
Expand Down
197 changes: 0 additions & 197 deletions src/classes/sites/genkanio.ts

This file was deleted.

14 changes: 9 additions & 5 deletions src/classes/sites/manganato.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import { parseHtmlFromString, titleContainsQuery } from 'src/utils/siteUtils'
import { Manga } from '../manga'
import { BaseData, BaseSite } from './baseSite'

interface ManganatoSearch {
interface ManganatoSearchItem {
name: string
image: string
lastchapter: string
'link_story': string
'url_story': string
}

interface ManganatoSearch {
searchlist: ManganatoSearchItem[]
}

class ManganatoData extends BaseData {
Expand Down Expand Up @@ -71,11 +75,11 @@ export class Manganato extends BaseSite {
}
const response = await requestHandler.sendRequest(request)

const searchData = JSON.parse(response.data) as ManganatoSearch[]
const searchData = JSON.parse(response.data) as ManganatoSearch
const mangaList = []
const parser = new DOMParser()

for (const entry of searchData) {
for (const entry of searchData.searchlist) {
const manga = new Manga('', this.siteType)
const docElement = (await parseHtmlFromString(entry.name, parser)).documentElement

Expand All @@ -84,7 +88,7 @@ export class Manganato extends BaseSite {

manga.image = entry.image
manga.chapter = entry.lastchapter
manga.url = entry.link_story
manga.url = entry.url_story

mangaList.push(manga)
}
Expand Down
2 changes: 1 addition & 1 deletion src/classes/sites/webtoons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class Webtoons extends BaseSite {
headers
}

const data = await getRssData(url, request)
const data = await getRssData({ url, request })
return this.buildManga(data)
}

Expand Down
19 changes: 15 additions & 4 deletions src/classes/sites/wordpress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { HEADER_USER_AGENT, MOBILE_USER_AGENT } from '../requests/baseRequest'
class WordPressData extends BaseData {
volume?: Element
volumeList?: Element[]
chapterText?: string | null
}

export class WordPress extends BaseSite {
Expand All @@ -32,7 +33,7 @@ export class WordPress extends BaseSite {
getChapter (data: WordPressData): string {
const volume = data.volume?.textContent?.trim() || 'Vol.01'
const chapterDate = data.chapterDate?.textContent?.trim() || ''
const chapter = data.chapter?.textContent?.replace(chapterDate, '').trim()
const chapter = data.chapterText?.replace(chapterDate, '').trim()

if (!volume.endsWith('.01') && !volume.endsWith(' 1') && chapter) {
return `${volume} | ${chapter}`
Expand All @@ -51,7 +52,7 @@ export class WordPress extends BaseSite {

data.volumeList?.forEach((element, index) => {
const chapterElement = element.querySelectorAll('.wp-manga-chapter a')[0]
const chapterText = chapterElement?.textContent?.trim()
const chapterText = this.getChapterText(chapterElement)
const chapterOfVolume = this.getSimpleChapterNum(chapterText)

// We only want decimal places if this is the current chapter, otherwise just add the floored volume number
Expand Down Expand Up @@ -266,13 +267,15 @@ export class WordPress extends BaseSite {
if (data.volume) {
const volumeParent = data.volume.parentElement
data.chapter = volumeParent?.querySelectorAll(chapterSelector)[0]
data.chapterText = this.getChapterText(data.chapter)
data.chapterDate = volumeParent?.querySelectorAll(chapterDateSelector)[0]
if (volumeParent) data.volumeList = [volumeParent]

return data
}

data.chapter = doc.querySelectorAll(chapterSelector)[0]
data.chapterText = this.getChapterText(data.chapter)
data.chapterDate = doc.querySelectorAll(chapterDateSelector)[0]
data.volumeList = Array.from(doc.querySelectorAll('.parent.has-child'))

Expand All @@ -286,6 +289,14 @@ export class WordPress extends BaseSite {
return url
}

private getChapterText (elem: Element | undefined): string | undefined {
if (elem?.childNodes[0]?.textContent?.trim()) {
return elem?.childNodes[0]?.textContent?.trim()
} else {
return elem?.textContent?.trim()
}
}

getLoginUrl (): string {
return this.getUrl()
}
Expand All @@ -297,11 +308,11 @@ export class WordPress extends BaseSite {
case SiteType.MangaKomi:
return `${this.getUrl()}/manga/good-night/`
case SiteType.HiperDEX:
return `${this.getUrl()}/manga/arata-primal-the-new-primitive/`
return `${this.getUrl()}/manga/10-years-in-the-friend-zone/`
case SiteType.MangaTx:
return `${this.getUrl()}/manga/grandest-wedding/`
case SiteType.LeviatanScans:
return `${this.getUrl()}/manga/the-throne/`
return `${this.getUrl()}/manga/i-am-the-sorcerer-king/`
case SiteType.SleepingKnightScans:
return `${this.getUrl()}/manga/chronicles-of-the-martial-gods-return/`
case SiteType.ReaperScans:
Expand Down
Loading

0 comments on commit dda3d4b

Please sign in to comment.