From feed8c8f95a7e80e1406ec797d00f721b144246a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Tue, 4 Dec 2018 14:23:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9Alaosiji=20hotshow=20?= =?UTF-8?q?(#1223)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #1222 --- docs/README.md | 1 + router.js | 1 + routes/laosiji/hotshow.js | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 routes/laosiji/hotshow.js diff --git a/docs/README.md b/docs/README.md index eae44d12a..0e92b6571 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2368,6 +2368,7 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 + ### 99% Invisible diff --git a/router.js b/router.js index fe2423566..7118bd649 100644 --- a/router.js +++ b/router.js @@ -724,6 +724,7 @@ router.get('/houxu/:type/:id', require('./routes/houxu/houxu')); // 老司机 router.get('/laosiji/hot', require('./routes/laosiji/hot')); router.get('/laosiji/feed', require('./routes/laosiji/feed')); +router.get('/laosiji/hotshow/:id', require('./routes/laosiji/hotshow')); // 99% Invisible router.get('/99percentinvisible/transcript', require('./routes/99percentinvisible/transcript')); diff --git a/routes/laosiji/hotshow.js b/routes/laosiji/hotshow.js new file mode 100644 index 000000000..cbfd2fcf1 --- /dev/null +++ b/routes/laosiji/hotshow.js @@ -0,0 +1,32 @@ +const axios = require('../../utils/axios'); +const qs = require('querystring'); + +module.exports = async (ctx) => { + const { id } = ctx.params; + const link = `http://www.laosiji.com/hotshow/detail/${id}`; + const response = await axios({ + method: 'post', + url: 'http://www.laosiji.com/api/hotShow/program', + headers: { + Referer: link, + 'Content-Type': 'application/x-www-form-urlencoded', + }, + data: qs.stringify({ + hotShowId: id, + sort: 1, + pageNo: 1, + }), + }); + + const data = response.data.body.hotshow; + + ctx.state.data = { + title: `老司机-${data.name}`, + link, + item: data.sns.list.map(({ title, resourceid, image }) => ({ + title, + link: `http://www.laosiji.com/thread/${resourceid}.html`, + description: ``, + })), + }; +};