Skip to content

Commit

Permalink
feat: support kakuyomu
Browse files Browse the repository at this point in the history
  • Loading branch information
IronKinoko committed Feb 19, 2024
1 parent 7e78b28 commit 4889e38
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-impalas-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'novel-speech-synthesis': patch
---

feat: support kakuyomu
1 change: 1 addition & 0 deletions packages/novel-speech-synthesis/meta.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// @match https://www.bilinovel.com/*
// @match https://www.linovelib.com/*
// @match https://novel18.syosetu.com/*
// @match https://kakuyomu.jp/*
// @match https://www.esjzone.cc/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=
// @grant none
Expand Down
24 changes: 24 additions & 0 deletions packages/novel-speech-synthesis/src/adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,28 @@ export const adapters: Adapter[] = [
},
],
},
{
domain: ['kakuyomu.jp'],
routes: [
{
pathname: /^\/works\/\d+\/episodes\/\d+$/,
speech: {
container: 'body',
lang: 'ja-JP',
getParagraph: () => {
const content = document.querySelector('.widget-episodeBody')
if (!content) throw new Error('content not found')

return Array.from(content.querySelectorAll('p'))
},
nextChapter() {
const dom = document.querySelector<HTMLAnchorElement>(
'#contentMain-readNextEpisode'
)
dom?.click()
},
},
},
],
},
]

0 comments on commit 4889e38

Please sign in to comment.