From 48d6ec476e889afddfa047016567522e4c951085 Mon Sep 17 00:00:00 2001
From: Wenmoux <45694869+Wenmoux@users.noreply.github.com>
Date: Sun, 14 Jun 2020 22:00:54 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E5=9C=BA=E5=BA=93=E4=BB=8A?=
=?UTF-8?q?=E6=97=A5=E7=B2=BE=E9=80=89=20(#4981)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/multimedia.md | 6 ++++++
lib/router.js | 3 +++
lib/routes/changku/index.js | 38 +++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+)
create mode 100644 lib/routes/changku/index.js
diff --git a/docs/multimedia.md b/docs/multimedia.md
index 0fc5d5fcd..0b4f2dabc 100644
--- a/docs/multimedia.md
+++ b/docs/multimedia.md
@@ -534,3 +534,9 @@ pageClass: routes
### 影视
+
+## 场库
+
+### 今日精选
+
+
diff --git a/lib/router.js b/lib/router.js
index 615cd5310..a42adb45d 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -2861,4 +2861,7 @@ router.get('/jike/user/:id', require('./routes/jike/user'));
// 网易新闻
router.get('/netease/news/rank/:category?/:type?/:time?', require('./routes/netease/news/rank'));
+// 场库
+router.get('/changku', require('./routes/changku/index'));
+
module.exports = router;
diff --git a/lib/routes/changku/index.js b/lib/routes/changku/index.js
new file mode 100644
index 000000000..6675c4dc0
--- /dev/null
+++ b/lib/routes/changku/index.js
@@ -0,0 +1,38 @@
+const got = require('@/utils/got');
+module.exports = async (ctx) => {
+ const url = `https://app.vmovier.com/apiv3/index/getIndexPosts/lastid/`;
+ const config = {
+ headers: {
+ 'user-agent': 'VmovierApp 5.7.7 / Android 10 / WIFI / 1080*2175 / 2.75',
+ 'content-type': 'application/x-www-form-urlencoded',
+ },
+ };
+ const res = await got({
+ method: 'get',
+ url: url,
+ });
+ const items = await Promise.all(
+ res.data.data.list.map(async (list) => {
+ const title = list.title;
+ const link = `https://app.vmovier.com/apiv3/post/view?postid=${list.postid}`;
+ const description = await ctx.cache.tryGet(link, async () => {
+ const res = await got.get(link, config);
+ const playurl = res.data.data.content_video[0].progressive[0].url;
+ const desc = `
${res.data.data.intro}
`;
+ return desc;
+ });
+ return Promise.resolve({
+ title: title,
+ description: description,
+ author: list.creator_username,
+ link: link,
+ });
+ })
+ );
+ ctx.state.data = {
+ title: `场库-每日精选`,
+ link: url,
+ description: '场库-每日精选',
+ item: items,
+ };
+};