mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-14 17:19:37 +08:00
refactor: remove await before cache.set
This commit is contained in:
@@ -36,7 +36,7 @@ module.exports = async (ctx) => {
|
|||||||
document.pubDate = new Date(Number($item('.standard-datetime').attr('data-epoch')) * 1000).toUTCString();
|
document.pubDate = new Date(Number($item('.standard-datetime').attr('data-epoch')) * 1000).toUTCString();
|
||||||
document.guid = $item('.md5').text();
|
document.guid = $item('.md5').text();
|
||||||
|
|
||||||
await ctx.cache.set(document.link, JSON.stringify(document));
|
ctx.cache.set(document.link, JSON.stringify(document));
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module.exports = async (ctx) => {
|
|||||||
guid: link,
|
guid: link,
|
||||||
link,
|
link,
|
||||||
};
|
};
|
||||||
await ctx.cache.set(link, cache);
|
ctx.cache.set(link, cache);
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ async function load(link, ctx) {
|
|||||||
|
|
||||||
// 定义description,并指定内容
|
// 定义description,并指定内容
|
||||||
const description = detailResult;
|
const description = detailResult;
|
||||||
await ctx.cache.set(link, description);
|
ctx.cache.set(link, description);
|
||||||
return {
|
return {
|
||||||
description,
|
description,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ async function load(link, ctx) {
|
|||||||
const $ = cheerio.load(response.data);
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
const description = $('div#Zoom').html();
|
const description = $('div#Zoom').html();
|
||||||
await ctx.cache.set(link, description);
|
ctx.cache.set(link, description);
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ async function load(link, ctx) {
|
|||||||
|
|
||||||
// 定义description,并指定内容
|
// 定义description,并指定内容
|
||||||
const description = detailResult;
|
const description = detailResult;
|
||||||
await ctx.cache.set(link, description);
|
ctx.cache.set(link, description);
|
||||||
return {
|
return {
|
||||||
description,
|
description,
|
||||||
link: link,
|
link: link,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ async function load(link, ctx) {
|
|||||||
|
|
||||||
// 定义description,并指定内容
|
// 定义description,并指定内容
|
||||||
const description = detailResult;
|
const description = detailResult;
|
||||||
await ctx.cache.set(link, description);
|
ctx.cache.set(link, description);
|
||||||
return {
|
return {
|
||||||
description,
|
description,
|
||||||
link: link,
|
link: link,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ async function load(link, ctx) {
|
|||||||
|
|
||||||
// 定义description,并指定内容
|
// 定义description,并指定内容
|
||||||
const description = detailResult;
|
const description = detailResult;
|
||||||
await ctx.cache.set(link, description);
|
ctx.cache.set(link, description);
|
||||||
return {
|
return {
|
||||||
description,
|
description,
|
||||||
link: link,
|
link: link,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ async function processReport(item, ctx) {
|
|||||||
description += `<img src="http://report.iresearch.cn/rimgs/${reportId}/${i}.jpg" rel="no-referrer"><br>`;
|
description += `<img src="http://report.iresearch.cn/rimgs/${reportId}/${i}.jpg" rel="no-referrer"><br>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ctx.cache.set(apiUrl, description);
|
ctx.cache.set(apiUrl, description);
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ async function load(link, ctx) {
|
|||||||
eventHtml = `<div><a href="${couponUrl}">点我前往活动</a></div>`;
|
eventHtml = `<div><a href="${couponUrl}">点我前往活动</a></div>`;
|
||||||
}
|
}
|
||||||
const description = eventHtml + $('.p-detail-html').html();
|
const description = eventHtml + $('.p-detail-html').html();
|
||||||
await ctx.cache.set(link, description);
|
ctx.cache.set(link, description);
|
||||||
return { description };
|
return { description };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module.exports = async (ctx) => {
|
|||||||
...oldPosts,
|
...oldPosts,
|
||||||
];
|
];
|
||||||
|
|
||||||
await ctx.cache.set(cacheName, item.slice(0, cacheLength));
|
ctx.cache.set(cacheName, item.slice(0, cacheLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ module.exports = async (ctx) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
await ctx.cache.set(tracking, JSON.stringify(single));
|
ctx.cache.set(tracking, JSON.stringify(single));
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ module.exports = async (ctx) => {
|
|||||||
link,
|
link,
|
||||||
};
|
};
|
||||||
|
|
||||||
await ctx.cache.set(link, JSON.stringify(item));
|
ctx.cache.set(link, JSON.stringify(item));
|
||||||
} else {
|
} else {
|
||||||
const description = news.summaryAuto || news.summary || news.title;
|
const description = news.summaryAuto || news.summary || news.title;
|
||||||
item = {
|
item = {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ module.exports = async (ctx) => {
|
|||||||
$('div .field-items')
|
$('div .field-items')
|
||||||
.find('p')
|
.find('p')
|
||||||
.text();
|
.text();
|
||||||
await ctx.cache.set(item.link, JSON.stringify(item));
|
ctx.cache.set(item.link, JSON.stringify(item));
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ async function load(link, ctx) {
|
|||||||
$(images[k]).replaceWith(`<img src="${url.resolve(host, $(images[k]).attr('src'))}" />`);
|
$(images[k]).replaceWith(`<img src="${url.resolve(host, $(images[k]).attr('src'))}" />`);
|
||||||
}
|
}
|
||||||
const description = $('.wp_articlecontent').html();
|
const description = $('.wp_articlecontent').html();
|
||||||
await ctx.cache.set(link, description);
|
ctx.cache.set(link, description);
|
||||||
return { description };
|
return { description };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ module.exports = async (ctx) => {
|
|||||||
.replace('作者:', '');
|
.replace('作者:', '');
|
||||||
item.description = article.find('.xwco').html();
|
item.description = article.find('.xwco').html();
|
||||||
|
|
||||||
await ctx.cache.set(item.link, JSON.stringify(item));
|
ctx.cache.set(item.link, JSON.stringify(item));
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ module.exports = async (ctx) => {
|
|||||||
item.description = article.find('.xwco').html();
|
item.description = article.find('.xwco').html();
|
||||||
item.category = map[category];
|
item.category = map[category];
|
||||||
|
|
||||||
await ctx.cache.set(item.link, JSON.stringify(item));
|
ctx.cache.set(item.link, JSON.stringify(item));
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ module.exports = async (ctx) => {
|
|||||||
item.description = $('.wp_articlecontent').html();
|
item.description = $('.wp_articlecontent').html();
|
||||||
item.category = map[category];
|
item.category = map[category];
|
||||||
|
|
||||||
await ctx.cache.set(item.link, JSON.stringify(item));
|
ctx.cache.set(item.link, JSON.stringify(item));
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ module.exports = async (ctx) => {
|
|||||||
.text();
|
.text();
|
||||||
item.description = article.find('.xwco').html();
|
item.description = article.find('.xwco').html();
|
||||||
|
|
||||||
await ctx.cache.set(item.link, JSON.stringify(item));
|
ctx.cache.set(item.link, JSON.stringify(item));
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports = async (ctx) => {
|
|||||||
).toUTCString();
|
).toUTCString();
|
||||||
item.description = $('.wp_articlecontent ').html();
|
item.description = $('.wp_articlecontent ').html();
|
||||||
|
|
||||||
await ctx.cache.set(item.link, JSON.stringify(item));
|
ctx.cache.set(item.link, JSON.stringify(item));
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ module.exports = async (ctx) => {
|
|||||||
item.description = article.find('.xwco').html();
|
item.description = article.find('.xwco').html();
|
||||||
item.category = map[category];
|
item.category = map[category];
|
||||||
|
|
||||||
await ctx.cache.set(item.link, JSON.stringify(item));
|
ctx.cache.set(item.link, JSON.stringify(item));
|
||||||
return Promise.resolve(item);
|
return Promise.resolve(item);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user