fix(route): recover a9vg (#14710)

docs: rename author #1066
This commit is contained in:
Tony 2024-03-08 10:05:44 +08:00 committed by GitHub
parent 59e96a6b1b
commit 031b4e8d88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 54 additions and 41 deletions

View File

@ -388,7 +388,7 @@ router.get('/blogread/newest', lazyloadRouteHandler('./routes/blogread/newest'))
router.get('/gnn/gnn', lazyloadRouteHandler('./routes/gnn/gnn'));
// a9vg游戏新闻
router.get('/a9vg/a9vg', lazyloadRouteHandler('./routes/a9vg/a9vg'));
// router.get('/a9vg/a9vg', lazyloadRouteHandler('./routes/a9vg/a9vg'));
// The Guardian
router.get('/guardian/:type', lazyloadRouteHandler('./routes/guardian/guardian'));

View File

@ -1,36 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'http://www.a9vg.com/list/news',
headers: {
Referer: 'http://www.a9vg.com/list/news',
},
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.a9-rich-card-list li');
ctx.state.data = {
title: 'A9VG电玩部落',
link: 'http://www.a9vg.com/list/news/',
description: '电玩资讯_电玩动态- A9VG电玩部落',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('.a9-rich-card-list_label').text(),
description: item.find('.a9-rich-card-list_summary').text() + '<img src="' + item.find('img').attr('src') + '">',
pubDate: new Date(item.find('.a9-rich-card-list_infos').text()).toUTCString(),
link: 'http://www.a9vg.com' + item.find('.a9-rich-card-list_item').attr('href'),
};
})
.get(),
};
};

30
lib/routes/a9vg/a9vg.ts Normal file
View File

@ -0,0 +1,30 @@
import got from '@/utils/got';
import * as cheerio from 'cheerio';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
export default async (ctx) => {
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: `<img src="${item.find('img').attr('src')}"><br>${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')}`,
};
});
ctx.set('data', {
title: 'A9VG 电玩部落',
link,
description: $('meta[name="description"]').attr('content'),
item: list,
});
};

View File

@ -0,0 +1,3 @@
export default {
'/': ['monnerHenster'],
};

13
lib/routes/a9vg/radar.ts Normal file
View File

@ -0,0 +1,13 @@
export default {
'a9vg.com': {
_name: 'A9VG 电玩部落',
'.': [
{
title: '游戏新闻',
docs: 'https://docs.rsshub.app/routes/game#a9vg-dian-wan-bu-luo',
source: ['/list/news', '/'],
target: '/a9vg',
},
],
},
};

View File

@ -0,0 +1,3 @@
export default (router) => {
router.get('/', './a9vg');
};

View File

@ -42,11 +42,11 @@
<Route author="Dlouxgit" example="/5eplay/article" path="/5eplay/article" notOperational="1" />
## a9vgNews 游戏新闻 {#a9vgnews-you-xi-xin-wen}
## A9VG 电玩部落 {#a9vg-dian-wan-bu-luo}
### a9vgNews 游戏新闻 {#a9vgnews-you-xi-xin-wen-a9vgnews-you-xi-xin-wen}
### 游戏新闻 {#a9vg-dian-wan-bu-luo-you-xi-xin-wen}
<Route author="monner-henster" example="/a9vg/a9vg" path="/a9vg/a9vg" />
<Route author="monnerHenster" example="/a9vg" path="/a9vg" radar="1" />
## Blizzard {#blizzard}
@ -236,7 +236,7 @@
### GNN.tw 游戏新闻 {#gnn-tw-you-xi-xin-wen-gnn-tw-you-xi-xin-wen}
<Route author="monner-henster" example="/gnn/gnn" path="/gnn/gnn" />
<Route author="monnerHenster" example="/gnn/gnn" path="/gnn/gnn" />
## HoYoLAB {#hoyolab}