From 46a403f28d96e25bc480aa558928aa76cbae142a Mon Sep 17 00:00:00 2001 From: jeffcott Date: Tue, 14 Jan 2020 15:51:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E7=99=BD=E9=B2=B8=E5=87=BA?= =?UTF-8?q?=E6=B5=B7=20(#3743)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/radar-rules.js | 11 ++++++++++ docs/new-media.md | 6 +++++ lib/router.js | 3 +++ lib/routes/baijing/index.js | 44 +++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 lib/routes/baijing/index.js diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 69fb36c02..b540f6dfc 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -956,4 +956,15 @@ }, ], }, + 'baijingapp.com': { + _name: '白鲸出海', + www: [ + { + title: '文章', + docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai', + source: '', + target: '/baijing', + }, + ], + }, }); diff --git a/docs/new-media.md b/docs/new-media.md index 54e9904a8..64ab5fff1 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -255,6 +255,12 @@ Supported sub-sites: +## 白鲸出海 + +### 首页最新帖子 + + + ## 坂道系列官网新闻 ### 乃木坂 46 diff --git a/lib/router.js b/lib/router.js index 4905534d5..b7e3e5ed1 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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('/baijing', require('./routes/baijing')); + // 低端影视 router.get('/ddrk/:name/:season?', require('./routes/ddrk/index')); diff --git a/lib/routes/baijing/index.js b/lib/routes/baijing/index.js new file mode 100644 index 000000000..435f22614 --- /dev/null +++ b/lib/routes/baijing/index.js @@ -0,0 +1,44 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'post', + url: 'http://www.baijingapp.com/api/get_more_articles/', + form: true, + responseType: 'json', + body: { + deviceid: 'ios', + page: 1, + }, + }); + + const resList = response.data; + + // json字符串转json对象 + const resListObj = new Function('return ' + resList)(); + + if (resListObj.state === 1) { + const output = resListObj.data.list.map((item) => { + const title = item.title; + const link = 'https://www.baijingapp.com/article/' + item.id; + const time = item.time; + const author = item.user_name; + const image = item.image; + const single = { + title, + link, + time, + author, + image, + }; + + return single; + }); + + ctx.state.data = { + title: `白鲸出海`, + desription: '白鲸出海 - 泛互联网出海服务平台', + item: output, + }; + } +};