mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: 新增公主链接日服公告 (#3735)
This commit is contained in:
@@ -362,3 +362,9 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
||||
### 公告
|
||||
|
||||
<Route author="magic-akari" example="/kirara/news" path="/kirara/news"/>
|
||||
|
||||
## 公主链接
|
||||
|
||||
### 日服公告
|
||||
|
||||
<Route author="SayaSS" example="/pcr/news" path="/pcr/news"/>
|
||||
|
||||
@@ -2098,6 +2098,9 @@ router.get('/mlog-club/projects', require('./routes/mlog-club/projects'));
|
||||
// Chrome 网上应用店
|
||||
router.get('/chrome/webstore/extensions/:id', require('./routes/chrome/extensions'));
|
||||
|
||||
// 公主链接日服公告
|
||||
router.get('/pcr/news', require('./routes/pcr/news'));
|
||||
|
||||
// project-zero issues
|
||||
router.get('/project-zero-issues', require('./routes/project-zero-issues/index'));
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://priconne-redive.jp/news/',
|
||||
});
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.article_box');
|
||||
let itemPicUrl;
|
||||
ctx.state.data = {
|
||||
title: '公主链接日服-新闻',
|
||||
link: 'https://priconne-redive.jp/news/',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
itemPicUrl = item.find('img.attachment-news-thumbnail').attr('src');
|
||||
return {
|
||||
title: item.find('h4').text(),
|
||||
description: `${item.find('.description p').text()}<br><img src="${itemPicUrl}">`,
|
||||
link: item
|
||||
.find('a')
|
||||
.first()
|
||||
.attr('href'),
|
||||
pubDate: item.find('.time').text(),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user