Skip to content

Commit

Permalink
feat(route): add 我不是盐神 (#14348)
Browse files Browse the repository at this point in the history
* Create common.js

* Create maintainer.js

* Create router.js

* Create radar.js

* Update common.js

A space is add after ','.

* Update common.js

A space is add after ','.

* Update common.js

* Update radar.js

* Update new-media.mdx

* Update maintainer.js

* Update radar.js

* Update radar.js

* Update radar.js
  • Loading branch information
ruoshui9527 authored Feb 2, 2024
1 parent 5a94d72 commit 0a909ec
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/v2/onehu/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');

module.exports = async (ctx) => {
const link = 'https://onehu.xyz';
const response = await got(link);
const data = response.data;
const $ = cheerio.load(data);
const list = $('#board article').toArray().map((item) => {
item = $(item);
return {
title: item.find('.index-header').text(),
link: item.find('.index-header').children('a').attr('href'),
description: item.find('.index-excerpt.index-excerpt__noimg').children('div').text(),
pubDate: timezone(parseDate(item.find('.post-meta.mr-3').children('time').attr('datetime'), 'YYYY年MM月DD日 HH:mm'), +8),
};
});

ctx.state.data = {
title: $('title').text(),
link,
item: list,
};

};
3 changes: 3 additions & 0 deletions lib/v2/onehu/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/': ['ruoshui9527'],
};
11 changes: 11 additions & 0 deletions lib/v2/onehu/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
'onehu.xyz': {
_name: '我不是盐神',
'.': [
{
title: '我不是盐神',
docs: 'https://docs.rsshub.app/routes/new-media#wo-bu-shi-yan-shen',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/onehu/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/', require('./common'));
};
6 changes: 6 additions & 0 deletions website/docs/routes/new-media.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5288,3 +5288,9 @@
### 公众号 {#zi-you-wei-xin-gong-zhong-hao}

<Route author="TonyRL" example="/freewechat/profile/MzI5NTUxNzk3OA==" path="/freewechat/profile/:id" paramsDesc={['公众号 ID,可在URL中找到']} radar="1" anticrawler="1" />

## 我不是盐神 {#wo-bu-shi-yan-shen}

### 首页 {#wo-bu-shi-yan-shen-shou-ye}

<Route author="ruoshui9527" example="/onehu" path="/onehu" />

0 comments on commit 0a909ec

Please sign in to comment.