diff --git a/lib/v2/u3c3/index.js b/lib/v2/u3c3/index.js
index e35ae9d41..428357d49 100644
--- a/lib/v2/u3c3/index.js
+++ b/lib/v2/u3c3/index.js
@@ -2,7 +2,7 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
- const type = ctx.params.type;
+ const { type, keywoard, preview } = ctx.params;
// should be:
// undefined
// U3C3
@@ -15,13 +15,12 @@ module.exports = async (ctx) => {
const rootURL = 'https://www.u3c3.com';
let currentURL;
let title;
- if (type === undefined) {
+ if (keywoard) {
+ currentURL = `${rootURL}/?search=${keywoard}`;
+ title = `search ${keywoard} - u3c3`;
+ } else if (type === undefined) {
currentURL = rootURL;
title = 'home - u3c3';
- } else if (type === 'search') {
- const keyword = ctx.params.keyword === undefined ? '' : ctx.params.keyword;
- currentURL = `${rootURL}/?search=${keyword}`;
- title = `search ${keyword} - u3c3`;
} else {
currentURL = `${rootURL}/?type=${type}&p=1`;
title = `${type} - u3c3`;
@@ -30,7 +29,7 @@ module.exports = async (ctx) => {
const response = await got(currentURL);
const $ = cheerio.load(response.data);
- const items = $('body > div.container > div.table-responsive > table > tbody > tr')
+ const list = $('body > div.container > div.table-responsive > table > tbody > tr')
.toArray()
.map((item) => {
item = $(item);
@@ -50,6 +49,21 @@ module.exports = async (ctx) => {
};
});
+ const items = preview
+ ? await Promise.all(
+ list.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const { data: response } = await got(item.link);
+ const $ = cheerio.load(response);
+
+ item.description = $('div.panel-footer > img:first-child').parent().html();
+
+ return item;
+ })
+ )
+ )
+ : list;
+
ctx.state.data = {
title,
description: title,
diff --git a/lib/v2/u3c3/maintainer.js b/lib/v2/u3c3/maintainer.js
index c7fbc179a..725114f6b 100644
--- a/lib/v2/u3c3/maintainer.js
+++ b/lib/v2/u3c3/maintainer.js
@@ -1,3 +1,4 @@
module.exports = {
- '/:type?/:keyword?': ['noname1897'],
+ '/search/:keyword/:preview?': ['storytellerF'],
+ '/:type?/:preview?': ['noname1897', 'storytellerF'],
};
diff --git a/lib/v2/u3c3/router.js b/lib/v2/u3c3/router.js
index 1b78935d6..c86f95d51 100644
--- a/lib/v2/u3c3/router.js
+++ b/lib/v2/u3c3/router.js
@@ -1,3 +1,4 @@
module.exports = function (router) {
- router.get('/:type?/:keyword?', require('./index'));
+ router.get('/search/:keyword/:preview?', require('./index'));
+ router.get('/:type?/:preview?', require('./index'));
};
diff --git a/website/docs/routes/multimedia.mdx b/website/docs/routes/multimedia.mdx
index 10a4cf967..bdb4e747b 100644
--- a/website/docs/routes/multimedia.mdx
+++ b/website/docs/routes/multimedia.mdx
@@ -1198,11 +1198,11 @@ Refer to [https://developers.themoviedb.org/3/getting-started/languages](https:/
### Keyword Search {#u3c3-keyword-search}
-
+
### Type {#u3c3-type}
-
+
## U9A9 {#u9a9}