mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
add-unit-image
This commit is contained in:
@@ -37,7 +37,10 @@ pageClass: routes
|
||||
|
||||
## Unit Image
|
||||
|
||||
<Route author="MisteryMonster" example="/unit-image/films" path="/unit-image/films" />
|
||||
### Films
|
||||
|
||||
<Route author="MisteryMonster" example="/unit-image/films/vfx" path="/unit-image/films/:type?" :paramsDesc="['Films 下分类,`vfx`, `game-trailer`, `animation`, `commercials`, `making-of`']"/>
|
||||
|
||||
## 站酷
|
||||
|
||||
### 推荐
|
||||
|
||||
@@ -24,6 +24,9 @@ pageClass: routes
|
||||
|
||||
<RouteEn author="miaoyafeng" example="/invisionapp/inside-design" path="/invisionapp/inside-design">
|
||||
</RouteEn>
|
||||
|
||||
## Unit Image
|
||||
|
||||
<Route author="MisteryMonster" example="/unit-image/films" path="/unit-image/films" />
|
||||
### Films
|
||||
|
||||
<RouteEn author="MisteryMonster" example="/unit-image/films/vfx" path="/unit-image/films/:type?" :paramsDesc="['Films type,`vfx`, `game-trailer`, `animation`, `commercials`, `making-of`']"/>
|
||||
|
||||
@@ -2556,5 +2556,5 @@ router.get('/51voa/:channel', require('./routes/51voa/channel'));
|
||||
router.get('/zhuixinfan/list', require('./routes/zhuixinfan/list'));
|
||||
|
||||
// unit-image
|
||||
router.get('/unit-image', require('./routes/unit-image/films'));
|
||||
router.get('/unit-image/films/:type?', require('./routes/unit-image/films'));
|
||||
module.exports = router;
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type ? `?filter=${ctx.params.type}` : '';
|
||||
const dataurl = `https://www.unit-image.fr/data/en/wp-json/unitimage/v1/films${type}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://www.unit-image.fr/data/en/wp-json/unitimage/v1/films`,
|
||||
url: dataurl,
|
||||
});
|
||||
const data = response.data.slice(0, 5);
|
||||
const list = data.content.posts;
|
||||
const data = response.data;
|
||||
const list = data.content.posts.slice(0, 5);
|
||||
const articledata = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const url = `https://www.unit-image.fr/data/en/wp-json/unitimage/v1${item.href}`; // 获取所有文章URL
|
||||
const cache = await ctx.cache.get(url); // 这里是不是单单缓存 URL?
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.phrase(cache)); // 如果有 URL 的缓存,则返回 JSON.phrase 的数据
|
||||
}
|
||||
|
||||
const response2 = await got({
|
||||
method: 'get',
|
||||
@@ -65,14 +63,13 @@ module.exports = async (ctx) => {
|
||||
compare,
|
||||
bhts,
|
||||
};
|
||||
ctx.cache.set(url, JSON.stringify(single)); // 设定缓存为序列化文章数据
|
||||
return Promise.resolve(single); // 返回 articledata 为序列化文章数据。
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
// 源标题
|
||||
title: `Unit Image Films`,
|
||||
title: `Unit Image | ${ctx.params.type}`,
|
||||
// 源链接
|
||||
link: `https://www.unit-image.fr/films`,
|
||||
// 源说明
|
||||
|
||||
Reference in New Issue
Block a user