feat(route): add 免費資源網路社群 (#14495)

* 增加 免費資源網路社群

* style: auto format

* 更新 rss.js

使用 wordpress 的 api 来获取数据

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

---------

Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
cnkmmk 2024-02-20 00:28:39 +08:00 committed by GitHub
parent f84d399fd6
commit 6b24b91f00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,3 @@
module.exports = {
'/': ['cnkmmk'],
};

13
lib/v2/free/radar.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
'free.com.tw': {
_name: '免費資源網路社群',
'.': [
{
title: '博客',
docs: 'https://docs.rsshub.app/routes/blog#mian-fei-zi-yuan-wang-lu-she-qun',
source: ['/'],
target: '/free',
},
],
},
};

3
lib/v2/free/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/', require('./rss'));
};

19
lib/v2/free/rss.js Normal file
View File

@ -0,0 +1,19 @@
const { parseDate } = require('@/utils/parse-date');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = 'https://free.com.tw/';
const response = await got(`${url}/wp-json/wp/v2/posts`);
const list = response.data;
ctx.state.data = {
title: '免費資源網路社群',
link: url,
description: '免費資源網路社群 - 全部文章',
item: list.map((item) => ({
title: item.title.rendered,
link: item.link,
pubDate: parseDate(item.date_gmt),
description: item.content.rendered,
})),
};
};

View File

@ -396,6 +396,12 @@
<Route author="LogicJake" example="/security/pulses" path="/security/pulses" anticrawler="1" />
## 免費資源網路社群 {#mian-fei-zi-yuan-wang-lu-she-qun}
### 博客 {#mian-fei-zi-yuan-wang-lu-she-qun-bo-ke}
<Route author="cnkmmk" example="/free" path="/free" />
## 十年之约 {#shi-nian-zhi-yue}
### 专题展示 - 文章 {#shi-nian-zhi-yue-zhuan-ti-zhan-shi-wen-zhang}