Skip to content

Commit

Permalink
feat(route): add HiFeng'Blog (DIYgod#14518)
Browse files Browse the repository at this point in the history
* 增加 免費資源網路社群

* style: auto format

* 更新 rss.js

使用 wordpress 的 api 来获取数据

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 增加 HiFeng'Blog

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 更新 rss.js

* 1

* 2

* 3

* 4

* 更新 rss.js

* 1

* 更新 router.js

* 更新 rss1.js

* 改router文件

* 更新 rss.js

* 修改 hicairo

* 更新 radar.js

* 更新 rss.js

* 更新 rss.js

* Update lib/v2/hicairo/radar.js

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

---------

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>
  • Loading branch information
3 people authored Feb 22, 2024
1 parent b53061b commit 1caaa4f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/v2/hicairo/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/': ['cnkmmk'],
};
13 changes: 13 additions & 0 deletions lib/v2/hicairo/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'hicairo.com': {
_name: "HiFeng'Blog",
'.': [
{
title: '博客',
docs: 'https://docs.rsshub.app/routes/blog#hifeng-blog',
source: ['/'],
target: '/hicairo',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/hicairo/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/', require('./rss'));
};
32 changes: 32 additions & 0 deletions lib/v2/hicairo/rss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const currentUrl = 'https://www.hicairo.com';
const response = await got(`${currentUrl}/feed.php`);
const $ = cheerio.load(response.data, { xmlMode: true });
const title_main = $('channel > title').text();
const description_main = $('channel > description').text();
const items = $('channel > item')
.map((_, item) => {
const $item = $(item);
const link = $item.find('link').text();
const title = $item.find('title').text();
const description = $item.find('description').text();
const pubDate = $item.find('pubDate').text();
return {
link,
pubDate, // no need to normalize because it's from a valid RSS feed
title,
description,
};
})
.get();

ctx.state.data = {
title: title_main,
description: description_main,
link: currentUrl,
item: items,
};
};
6 changes: 6 additions & 0 deletions website/docs/routes/blog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,9 @@
### 上周热门 TOP 20 {#zhu-bai-shang-zhou-re-men-top-20}

<Route author="nczitzk" example="/zhubai/top20" path="/zhubai/top20" radar="1" />

## HiFeng'Blog {#Hi-Feng-Blog}

### 博客 {#Hi-Feng-Blog-bo-ke}

<Route author="aneasystone" example="/hicairo" path="/hicairo" />

0 comments on commit 1caaa4f

Please sign in to comment.