From 4b51ba54f4563c08269dc530d63860ee1f6ab9bc Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Sun, 28 Jun 2020 04:20:10 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=20=E8=85=BE=E8=AE=AF=E6=9F=A0?= =?UTF-8?q?=E6=AA=AC=E7=B2=BE=E9=80=89=20(#5066)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/program-update.md | 6 ++++++ docs/programming.md | 2 +- lib/router.js | 3 +++ lib/routes/tencent/lemon/index.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 lib/routes/tencent/lemon/index.js diff --git a/docs/program-update.md b/docs/program-update.md index ec95ef7ace..a300754039 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -260,6 +260,12 @@ pageClass: routes +## 腾讯柠檬 Lab + +### 柠檬精选 Mac Apps + + + ## 腾讯云移动直播 SDK ### 更新日志 diff --git a/docs/programming.md b/docs/programming.md index 5466d9badb..a2305acb0c 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -155,7 +155,7 @@ GitHub 官方也提供了一些 RSS: -## Go语言中文网 +## Go 语言中文网 ### 周刊 diff --git a/lib/router.js b/lib/router.js index 7718da0249..0ca7e7f696 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2005,6 +2005,9 @@ router.get('/sohu/mp/:id', require('./routes/sohu/mp')); // 腾讯企鹅号 router.get('/tencent/news/author/:mid', require('./routes/tencent/news/author')); +// 腾讯柠檬精选 +router.get('/tencent/lemon', require('./routes/tencent/lemon/index')); + // 奈菲影视 router.get('/nfmovies/:id?', require('./routes/nfmovies/index')); diff --git a/lib/routes/tencent/lemon/index.js b/lib/routes/tencent/lemon/index.js new file mode 100644 index 0000000000..d3816da822 --- /dev/null +++ b/lib/routes/tencent/lemon/index.js @@ -0,0 +1,29 @@ +const got = require('@/utils/got'); +const date = require('@/utils/date'); + +module.exports = async (ctx) => { + const url = 'https://lemon.qq.com/lab/js/source.js'; + + let data = (await got.get(url)).data.match(/(?<=(var list = ))(.*)(\])/gs)[0]; + + // eslint-disable-next-line no-eval + data = eval('(' + data + ')').slice(0, 10); + + const items = data.map((i) => ({ + title: i.name, + description: ` + ${i.comment}
+
+ 下载链接 + `, + link: `https://lemon.qq.com/lab/app/${i.shortname}.html`, + author: i.referrer, + pubDate: date(i.date), + })); + + ctx.state.data = { + title: '腾讯柠檬精选', + link: 'https://lemon.qq.com/lab/', + item: items, + }; +};