From 080796cc4fb7e5552791c309d8c05fe98a25c289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20Ero=C4=9Flu?= Date: Sat, 1 Aug 2026 06:41:08 +0300 Subject: [PATCH] feat(route): add Omega Scans route (#22904) * feat(route): add Omega Scans route * fix(route): fix improper error, limit and filters --- lib/routes/omegascans/namespace.ts | 9 ++++ lib/routes/omegascans/series.ts | 77 ++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 lib/routes/omegascans/namespace.ts create mode 100644 lib/routes/omegascans/series.ts diff --git a/lib/routes/omegascans/namespace.ts b/lib/routes/omegascans/namespace.ts new file mode 100644 index 0000000000..7a8df29f0c --- /dev/null +++ b/lib/routes/omegascans/namespace.ts @@ -0,0 +1,9 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: 'Omega Scans', + url: 'omegascans.org', + description: `::: tip +Omega Scans is a localization team working tirelessly to provide readers with high-quality Comics and Novels to read. +:::`, +}; diff --git a/lib/routes/omegascans/series.ts b/lib/routes/omegascans/series.ts new file mode 100644 index 0000000000..4bb55363b9 --- /dev/null +++ b/lib/routes/omegascans/series.ts @@ -0,0 +1,77 @@ +import NotFoundError from '@/errors/types/not-found'; +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { parseDate } from '@/utils/parse-date'; + +interface Chapter { + id: number; + chapter_name: string; + chapter_title: string | null; + chapter_thumbnail: string | null; + chapter_slug: string; + price: number; + created_at: string; + series: { + series_slug: string; + id: number; + }; +} + +interface ChapterQueryResponse { + data: Chapter[]; +} + +export const route: Route = { + path: '/series/:id', + name: 'Series Chapters', + url: 'omegascans.org', + maintainers: ['ereneroglum'], + example: '/omegascans/series/632', + parameters: { + id: 'Series ID, can be found in API get request on series page', + }, + categories: ['anime'], + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportRadar: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + handler: async (ctx) => { + const { id } = ctx.req.param(); + + const response = await ofetch('https://api.omegascans.org/chapter/query', { + query: { + page: 1, + perPage: 30, + series_id: id, + }, + }); + + const chapters = response.data; + if (chapters.length === 0) { + throw new NotFoundError(`Series ${id} not found on Omega Scans`); + } + + const seriesSlug = chapters[0].series.series_slug; + const seriesTitle = seriesSlug.replaceAll('-', ' ').replaceAll(/\b\w/g, (c) => c.toUpperCase()); + const seriesLink = `https://omegascans.org/series/${seriesSlug}`; + + return { + title: `Omega Scans - ${seriesTitle}`, + link: seriesLink, + image: 'https://omegascans.org/wetried_only.png', + item: chapters.map((chapter) => ({ + title: chapter.chapter_title ?? chapter.chapter_name, + link: `https://omegascans.org/series/${chapter.series.series_slug}/${chapter.chapter_slug}`, + pubDate: parseDate(chapter.created_at), + image: chapter.chapter_thumbnail ?? undefined, + guid: `omegascans-chapter-${chapter.id}`, + category: [chapter.price === 0 ? 'Free' : 'Paid'], + })), + }; + }, +};