mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-19 06:38:55 +08:00
add-unit-image
This commit is contained in:
@@ -12,7 +12,10 @@ module.exports = async (ctx) => {
|
|||||||
const articledata = await Promise.all(
|
const articledata = await Promise.all(
|
||||||
list.map(async (item) => {
|
list.map(async (item) => {
|
||||||
const url = `https://www.unit-image.fr/data/en/wp-json/unitimage/v1${item.href}`; // 获取所有文章URL
|
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.parse(cache)); // 如果有 URL 的缓存,则返回 JSON.phrase 的数据
|
||||||
|
}
|
||||||
const response2 = await got({
|
const response2 = await got({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url,
|
url,
|
||||||
@@ -63,6 +66,7 @@ module.exports = async (ctx) => {
|
|||||||
compare,
|
compare,
|
||||||
bhts,
|
bhts,
|
||||||
};
|
};
|
||||||
|
ctx.cache.set(url, JSON.stringify(single)); // 设定缓存为序列化文章数据
|
||||||
return Promise.resolve(single); // 返回 articledata 为序列化文章数据。
|
return Promise.resolve(single); // 返回 articledata 为序列化文章数据。
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user