-
Notifications
You must be signed in to change notification settings - Fork 345
feat(id): Add Plugin Meionovel Translate Indonesian #2487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RasyaD86
wants to merge
12
commits into
lnreader:master
Choose a base branch
from
RasyaD86:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+210
−0
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
99c59f3
Create meionovel.ts
RasyaD86 61b83d5
Update meionovel.ts
RasyaD86 c157921
Create meionovel
RasyaD86 c8d80db
Create README.md
RasyaD86 adbe2e6
Add files via upload
RasyaD86 3abf53c
Delete public/static/src/id/meionovel
RasyaD86 d623a6e
Delete public/static/src/id/meionovel /README.md
RasyaD86 5b85ac1
Create readme
RasyaD86 5770b96
icon.png
RasyaD86 ebe7506
Update meionovel.ts
RasyaD86 8098ae7
Delete public/static/src/id/meionovel/download (1).jpeg
RasyaD86 8f69139
Add files via upload
RasyaD86 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| import { Plugin } from "@typings/plugin"; | ||
| import { fetchApi } from "@libs/fetch"; | ||
| import { NovelStatus } from "@libs/novelStatus"; | ||
| import { load as parseHTML } from "cheerio"; | ||
| import { defaultCover } from "@libs/defaultCover"; | ||
| import { FilterTypes, Filters } from "@libs/filterInputs"; | ||
|
|
||
| class Meionovel implements Plugin.PluginBase { | ||
| id = "meionovel"; | ||
| name = "Meionovel"; | ||
| icon = "src/id/meionovel/icon.png"; | ||
| site = "https://meionovels.com"; | ||
| version = "1.0.0"; | ||
|
|
||
| filters = { | ||
| order: { | ||
| value: "popular", | ||
| label: "Urutkan", | ||
| type: FilterTypes.Picker, | ||
| options: [ | ||
| { label: "Populer", value: "popular" }, | ||
| { label: "Terbaru", value: "latest" }, | ||
| { label: "A-Z", value: "alphabet" }, | ||
| { label: "Rating", value: "rating" }, | ||
| ], | ||
| }, | ||
| genre: { | ||
| value: "", | ||
| label: "Genre", | ||
| type: FilterTypes.Picker, | ||
| options: [ | ||
| { label: "Semua", value: "" }, | ||
| { label: "Action", value: "action" }, | ||
| { label: "Adventure", value: "adventure" }, | ||
| { label: "Comedy", value: "comedy" }, | ||
| { label: "Drama", value: "drama" }, | ||
| { label: "Fantasy", value: "fantasy" }, | ||
| { label: "Harem", value: "harem" }, | ||
| { label: "Isekai", value: "isekai" }, | ||
| { label: "Mystery", value: "mystery" }, | ||
| { label: "Romance", value: "romance" }, | ||
| { label: "Sci-fi", value: "sci-fi" }, | ||
| { label: "Slice of Life", value: "slice-of-life" }, | ||
| { label: "Supernatural", value: "supernatural" }, | ||
| ], | ||
| }, | ||
| } satisfies Filters; | ||
|
|
||
| async popularNovels( | ||
| pageNo: number, | ||
| options: Plugin.PopularNovelsOptions<typeof this.filters> | ||
| ): Promise<Plugin.NovelItem[]> { | ||
| const novels: Plugin.NovelItem[] = []; | ||
| let url = `${this.site}/novel/`; | ||
|
|
||
| if (options.filters?.genre?.value) { | ||
| url = `${this.site}/genre/${options.filters.genre.value}/`; | ||
| } | ||
|
|
||
| if (pageNo > 1) { | ||
| url += `page/${pageNo}/`; | ||
| } | ||
|
|
||
| const order = options.showLatestNovels ? "latest" : options.filters?.order?.value; | ||
| if (order) { | ||
| url += `?m_orderby=${order}`; | ||
| } | ||
|
|
||
| const result = await fetchApi(url); | ||
| const body = await result.text(); | ||
| const $ = parseHTML(body); | ||
|
|
||
| $(".page-item-detail, .manga-item, article.post, .series-item").each((_, element) => { | ||
| const name = $(element).find(".post-title a, .title a, .entry-title a, h3 a").text().trim(); | ||
| const coverUrl = | ||
| $(element).find("img").attr("data-src") || | ||
| $(element).find("img").attr("src") || | ||
| defaultCover; | ||
| const novelUrl = $(element).find(".post-title a, .title a, .entry-title a, h3 a").attr("href"); | ||
|
|
||
| if (name && novelUrl) { | ||
| const path = novelUrl.replace(this.site, ""); | ||
| novels.push({ | ||
| name, | ||
| cover: coverUrl, | ||
| path, | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| return novels; | ||
| } | ||
|
|
||
| async parseNovel(novelPath: string): Promise<Plugin.SourceNovel> { | ||
| const url = `${this.site}${novelPath}`; | ||
| const result = await fetchApi(url); | ||
| const body = await result.text(); | ||
| const $ = parseHTML(body); | ||
|
|
||
| const novel: Plugin.SourceNovel = { | ||
| path: novelPath, | ||
| name: $(".post-title h1, .entry-title, .series-title").text().trim() || "Tanpa Judul", | ||
| cover: | ||
| $(".summary_image img, .series-thumb img, .poster img").attr("data-src") || | ||
| $(".summary_image img, .series-thumb img, .poster img").attr("src") || | ||
| defaultCover, | ||
| summary: $(".summary__content, .entry-content, .series-synopsis").text().trim(), | ||
| status: NovelStatus.Unknown, | ||
| chapters: [], | ||
| }; | ||
|
|
||
| // Extract Status | ||
| const statusText = $(".post-status .summary-content, .status-label, .series-info").text().toLowerCase(); | ||
| if (statusText.includes("ongoing") || statusText.includes("berjalan")) { | ||
| novel.status = NovelStatus.Ongoing; | ||
| } else if (statusText.includes("completed") || statusText.includes("tamat")) { | ||
| novel.status = NovelStatus.Completed; | ||
| } | ||
|
|
||
| // Extract Author & Artist | ||
| const author = $(".author-content a, .artist-content a").text().trim(); | ||
| if (author) { | ||
| novel.author = author; | ||
| } | ||
|
|
||
| // Extract Genres | ||
| const genres: string[] = []; | ||
| $(".genres-content a, .series-genres a").each((_, el) => { | ||
| const genre = $(el).text().trim(); | ||
| if (genre) genres.push(genre); | ||
| }); | ||
| if (genres.length > 0) { | ||
| novel.genres = genres.join(", "); | ||
| } | ||
|
|
||
| const chapters: Plugin.ChapterItem[] = []; | ||
|
|
||
| $(".wp-manga-chapter, .wp-manga-chapter-item, .series-chapters li").each((_, element) => { | ||
| const chapterName = $(element).find("a").text().trim().replace(/\s+/g, " "); | ||
| const chapterUrl = $(element).find("a").attr("href"); | ||
| const releaseTime = $(element).find(".chapter-release-date, span.date").text().trim(); | ||
|
|
||
| if (chapterName && chapterUrl) { | ||
| const chapterPath = chapterUrl.replace(this.site, ""); | ||
| chapters.push({ | ||
| name: chapterName, | ||
| path: chapterPath, | ||
| releaseTime: releaseTime || undefined, | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| // LNReader memerlukan urutan chapter dari awal hingga terbaru | ||
| novel.chapters = chapters.reverse(); | ||
|
|
||
| return novel; | ||
| } | ||
|
|
||
| async parseChapter(chapterPath: string): Promise<string> { | ||
| const url = `${this.site}${chapterPath}`; | ||
| const result = await fetchApi(url); | ||
| const body = await result.text(); | ||
| const $ = parseHTML(body); | ||
|
|
||
| const contentElement = $(".reading-content, .entry-content, .epcontent"); | ||
|
|
||
| // Hapus elemen iklan, script, dan pelacak | ||
| contentElement.find("script, style, ins, .ads, .ad-box, .sharedaddy, .adsbygoogle").remove(); | ||
|
|
||
| const chapterHtml = contentElement.html() || ""; | ||
| return chapterHtml.trim(); | ||
| } | ||
|
|
||
| async searchNovels(searchTerm: string, pageNo: number): Promise<Plugin.NovelItem[]> { | ||
| let url = `${this.site}/?s=${encodeURIComponent(searchTerm)}&post_type=wp-manga`; | ||
| if (pageNo > 1) { | ||
| url += `&paged=${pageNo}`; | ||
| } | ||
|
|
||
| const result = await fetchApi(url); | ||
| const body = await result.text(); | ||
| const $ = parseHTML(body); | ||
|
|
||
| const novels: Plugin.NovelItem[] = []; | ||
|
|
||
| $(".c-tabs-item__content, .page-item-detail, .search-wrap .post, article").each((_, element) => { | ||
| const name = $(element).find(".post-title a, .entry-title a, h3 a").text().trim(); | ||
| const coverUrl = | ||
| $(element).find("img").attr("data-src") || | ||
| $(element).find("img").attr("src") || | ||
| defaultCover; | ||
| const novelUrl = $(element).find(".post-title a, .entry-title a, h3 a").attr("href"); | ||
|
|
||
| if (name && novelUrl) { | ||
| const path = novelUrl.replace(this.site, ""); | ||
| novels.push({ | ||
| name, | ||
| cover: coverUrl, | ||
| path, | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| return novels; | ||
| } | ||
| } | ||
|
|
||
| export default new Meionovel(); | ||
|
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you remove this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove this?