mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 19:50:01 +08:00
@@ -22,17 +22,15 @@ module.exports = async (ctx) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const $ = cheerio.load(response.data);
|
const $ = cheerio.load(response.data);
|
||||||
const list = $('#gs_res_ccl_mid .gs_r.gs_or.gs_scl .gs_ri');
|
const list = $('#gs_res_ccl_mid .gs_r.gs_or.gs_scl .gs_ri').get();
|
||||||
|
|
||||||
const out = [];
|
const out = await Promise.all(
|
||||||
|
list.map(async (item) => {
|
||||||
for (let i = 0; i < list.length; i++) {
|
const $ = cheerio.load(item);
|
||||||
const $ = cheerio.load(list[i]);
|
|
||||||
const itemUrl = $('h3 a').attr('href');
|
const itemUrl = $('h3 a').attr('href');
|
||||||
const cache = await ctx.cache.get(itemUrl);
|
const cache = await ctx.cache.get(itemUrl);
|
||||||
if (cache) {
|
if (cache) {
|
||||||
out.push(JSON.parse(cache));
|
return Promise.resolve(JSON.parse(cache));
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
const single = {
|
const single = {
|
||||||
title: $('h3 a').text(),
|
title: $('h3 a').text(),
|
||||||
@@ -42,9 +40,9 @@ module.exports = async (ctx) => {
|
|||||||
guid: itemUrl,
|
guid: itemUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
out.push(single);
|
return Promise.resolve(single);
|
||||||
}
|
})
|
||||||
|
);
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: `Google Scholar Monitor: ${query}`,
|
title: `Google Scholar Monitor: ${query}`,
|
||||||
link: url,
|
link: url,
|
||||||
|
|||||||
Reference in New Issue
Block a user