diff --git a/lib/routes/a9vg/a9vg.ts b/lib/routes/a9vg/a9vg.ts
deleted file mode 100644
index b86c783bb..000000000
--- a/lib/routes/a9vg/a9vg.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { Route } from '@/types';
-import got from '@/utils/got';
-import * as cheerio from 'cheerio';
-import { parseDate } from '@/utils/parse-date';
-import timezone from '@/utils/timezone';
-
-export const route: Route = {
- path: '/',
- radar: [
- {
- source: ['a9vg.com/list/news', 'a9vg.com/'],
- target: '',
- },
- ],
- name: 'Unknown',
- maintainers: ['monnerHenster'],
- handler,
- url: 'a9vg.com/list/news',
-};
-
-async function handler() {
- const baseUrl = 'http://www.a9vg.com';
- const link = `${baseUrl}/list/news`;
- const { data } = await got(link);
-
- const $ = cheerio.load(data);
- const list = $('.a9-rich-card-list li')
- .toArray()
- .map((elem) => {
- const item = $(elem);
- return {
- title: item.find('.a9-rich-card-list_label').text(),
- description: `.attr('src')})
${item.find('.a9-rich-card-list_summary').text().trim()}`,
- pubDate: timezone(parseDate(item.find('.a9-rich-card-list_infos').text().trim(), 'YYYY-MM-DD HH:mm:ss'), 8),
- link: `${baseUrl}${item.find('.a9-rich-card-list_item').attr('href')}`,
- };
- });
-
- return {
- title: 'A9VG 电玩部落',
- link,
- description: $('meta[name="description"]').attr('content'),
- item: list,
- };
-}
diff --git a/lib/routes/a9vg/index.ts b/lib/routes/a9vg/index.ts
new file mode 100644
index 000000000..7b0db41e0
--- /dev/null
+++ b/lib/routes/a9vg/index.ts
@@ -0,0 +1,214 @@
+import { Route } from '@/types';
+import { getCurrentPath } from '@/utils/helpers';
+const __dirname = getCurrentPath(import.meta.url);
+
+import cache from '@/utils/cache';
+import got from '@/utils/got';
+import { load } from 'cheerio';
+import timezone from '@/utils/timezone';
+import { parseDate } from '@/utils/parse-date';
+import { art } from '@/utils/render';
+import path from 'node:path';
+
+export const handler = async (ctx) => {
+ const { category = 'news/All' } = ctx.req.param();
+ const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 15;
+
+ const rootUrl = 'http://www.a9vg.com';
+ const currentUrl = new URL(`list/${category}`, rootUrl).href;
+
+ const { data: response } = await got(currentUrl);
+
+ const $ = load(response);
+
+ const language = $('html').prop('lang');
+
+ let items = $('a.a9-rich-card-list_item')
+ .slice(0, limit)
+ .toArray()
+ .map((item) => {
+ item = $(item);
+
+ const image = item.find('img.a9-rich-card-list_image');
+ const title = item.find('div.a9-rich-card-list_label').text();
+
+ return {
+ title,
+ link: new URL(item.prop('href'), rootUrl).href,
+ description: art(path.join(__dirname, 'templates/description.art'), {
+ images: image
+ ? [
+ {
+ src: image.prop('src'),
+ alt: title,
+ },
+ ]
+ : undefined,
+ }),
+ pubDate: timezone(parseDate(item.find('div.a9-rich-card-list_infos').text()), +8),
+ language,
+ };
+ });
+
+ items = await Promise.all(
+ items.map((item) =>
+ cache.tryGet(item.link, async () => {
+ const { data: detailResponse } = await got(item.link);
+
+ const $$ = load(detailResponse);
+
+ $$('ignore_js_op img, p img').each((_, el) => {
+ el = $$(el);
+
+ el.parent().replaceWith(
+ art(path.join(__dirname, 'templates/description.art'), {
+ images: el.prop('file')
+ ? [
+ {
+ src: el.prop('file'),
+ alt: el.next().find('div.xs0 p').first().text(),
+ },
+ ]
+ : undefined,
+ })
+ );
+ });
+
+ item.title = $$('h1.ts, div.c-article-main_content-title').first().text();
+ item.description = art(path.join(__dirname, 'templates/description.art'), {
+ description: $$('td.t_f, div.c-article-main_contentraw').first().html(),
+ });
+ item.author =
+ $$('b a.blue').first().text() ||
+ $$(
+ $$('span.c-article-main_content-intro-item')
+ .toArray()
+ .findLast((i) => $$(i).text().startsWith('作者'))
+ )
+ .text()
+ .split(/:/)
+ .pop();
+ item.pubDate = timezone(
+ parseDate(
+ $$('div.authi em')
+ .first()
+ .text()
+ .trim()
+ .match(/发表于 (\d+-\d+-\d+ \d+:\d+)/)?.[1] ?? $$('span.c-article-main_content-intro-item').first().text(),
+ ['YYYY-M-D HH:mm', 'YYYY-MM-DD HH:mm']
+ ),
+ +8
+ );
+ item.language = language;
+
+ return item;
+ })
+ )
+ );
+
+ const title = $('title').text();
+ const image = new URL('images/logo.1cee7c0f.svg', rootUrl).href;
+
+ return {
+ title,
+ description: $('meta[name="description"]').prop('content'),
+ link: currentUrl,
+ item: items,
+ allowEmpty: true,
+ image,
+ author: title.split(/-/).pop(),
+ language,
+ };
+};
+
+export const route: Route = {
+ path: '/:category{.+}?',
+ name: '新闻',
+ url: 'a9vg.com',
+ maintainers: ['monnerHenster', 'nczitzk'],
+ handler,
+ example: '/a9vg/news',
+ parameters: { category: '分类,默认为 ,可在对应分类页 URL 中找到, Category, by default' },
+ description: `:::tip
+ 若订阅 [PS4](http://www.a9vg.com/list/news/PS4),网址为 \`http://www.a9vg.com/list/news/PS4\`。截取 \`http://www.a9vg.com/list\` 到末尾的部分 \`news/PS4\` 作为参数填入,此时路由为 [\`/a9vg/news/PS4\`](https://rsshub.app/a9vg/news/PS4)。
+ :::
+
+ | 分类 | ID |
+ | -------------------------------------------------- | ------------------------------------------------------ |
+ | [All](https://www.a9vg.com/list/news/All) | [news/All](https://rsshub.app/a9vg/news/All) |
+ | [PS4](https://www.a9vg.com/list/news/PS4) | [news/PS4](https://rsshub.app/a9vg/news/PS4) |
+ | [PS5](https://www.a9vg.com/list/news/PS5) | [news/PS5](https://rsshub.app/a9vg/news/PS5) |
+ | [Switch](https://www.a9vg.com/list/news/Switch) | [news/Switch](https://rsshub.app/a9vg/news/Switch) |
+ | [Xbox One](https://www.a9vg.com/list/news/XboxOne) | [news/XboxOne](https://rsshub.app/a9vg/news/XboxOne) |
+ | [XSX](https://www.a9vg.com/list/news/XSX) | [news/XSX](https://rsshub.app/a9vg/news/XSX) |
+ | [PC](https://www.a9vg.com/list/news/PC) | [news/PC](https://rsshub.app/a9vg/news/PC) |
+ | [业界](https://www.a9vg.com/list/news/Industry) | [news/Industry](https://rsshub.app/a9vg/news/Industry) |
+ | [厂商](https://www.a9vg.com/list/news/Factory) | [news/Factory](https://rsshub.app/a9vg/news/Factory) |
+ `,
+ categories: ['game'],
+
+ features: {
+ requireConfig: false,
+ requirePuppeteer: false,
+ antiCrawler: false,
+ supportRadar: true,
+ supportBT: false,
+ supportPodcast: false,
+ supportScihub: false,
+ },
+ radar: [
+ {
+ source: ['www.a9vg.com/list/:category'],
+ target: (params) => {
+ const category = params.category;
+
+ return category ? `/${category}` : '';
+ },
+ },
+ {
+ title: 'All',
+ source: ['www.a9vg.com/list/news/All'],
+ target: '/news/All',
+ },
+ {
+ title: 'PS4',
+ source: ['www.a9vg.com/list/news/PS4'],
+ target: '/news/PS4',
+ },
+ {
+ title: 'PS5',
+ source: ['www.a9vg.com/list/news/PS5'],
+ target: '/news/PS5',
+ },
+ {
+ title: 'Switch',
+ source: ['www.a9vg.com/list/news/Switch'],
+ target: '/news/Switch',
+ },
+ {
+ title: 'Xbox One',
+ source: ['www.a9vg.com/list/news/XboxOne'],
+ target: '/news/XboxOne',
+ },
+ {
+ title: 'XSX',
+ source: ['www.a9vg.com/list/news/XSX'],
+ target: '/news/XSX',
+ },
+ {
+ title: 'PC',
+ source: ['www.a9vg.com/list/news/PC'],
+ target: '/news/PC',
+ },
+ {
+ title: '业界',
+ source: ['www.a9vg.com/list/news/Industry'],
+ target: '/news/Industry',
+ },
+ {
+ title: '厂商',
+ source: ['www.a9vg.com/list/news/Factory'],
+ target: '/news/Factory',
+ },
+ ],
+};
diff --git a/lib/routes/a9vg/namespace.ts b/lib/routes/a9vg/namespace.ts
index 074bd1620..545b90905 100644
--- a/lib/routes/a9vg/namespace.ts
+++ b/lib/routes/a9vg/namespace.ts
@@ -3,4 +3,5 @@ import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'A9VG 电玩部落',
url: 'a9vg.com',
+ description: '',
};
diff --git a/lib/routes/a9vg/templates/description.art b/lib/routes/a9vg/templates/description.art
new file mode 100644
index 000000000..dfab19230
--- /dev/null
+++ b/lib/routes/a9vg/templates/description.art
@@ -0,0 +1,17 @@
+{{ if images }}
+ {{ each images image }}
+ {{ if image?.src }}
+
+
+
+ {{ /if }}
+ {{ /each }}
+{{ /if }}
+
+{{ if description }}
+ {{@ description }}
+{{ /if }}
\ No newline at end of file