mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
fix: FZU add detailed discription
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
const response = await got({
|
const response = await got({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -9,15 +10,57 @@ module.exports = async (ctx) => {
|
|||||||
});
|
});
|
||||||
const data = response.data.data;
|
const data = response.data.data;
|
||||||
|
|
||||||
|
const urls = [];
|
||||||
|
for (const key of data) {
|
||||||
|
urls.push(key.url);
|
||||||
|
};
|
||||||
|
|
||||||
|
const mains = [];
|
||||||
|
for (const key of urls) {
|
||||||
|
const response = await got(key);
|
||||||
|
const data1 = response.data;
|
||||||
|
const $ = cheerio.load(data1);
|
||||||
|
$('.padTB15').remove();
|
||||||
|
$('.c-txt').remove();
|
||||||
|
const main = $('.xl_main');
|
||||||
|
mains.push(main.html());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
const mains = [];
|
||||||
|
await Promise.all(urls.map(async (item) => {
|
||||||
|
console.log(item);
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: item,
|
||||||
|
headers: {
|
||||||
|
Referer: `http://jwch.fzu.edu.cn/jxtz/`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const data1 = response.data;
|
||||||
|
const $ = cheerio.load(data1);
|
||||||
|
$('.padTB15').remove();
|
||||||
|
$('.c-txt').remove();
|
||||||
|
const main = $('.xl_main');
|
||||||
|
console.log(item);
|
||||||
|
mains.push(main.html());
|
||||||
|
return mains;
|
||||||
|
}));
|
||||||
|
*/
|
||||||
|
|
||||||
|
let i = -1;
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: `福州大学教务处教学通知`,
|
title: `福州大学教务处教学通知`,
|
||||||
link: `http://jwch.fzu.edu.cn/jxtz/`,
|
link: `http://jwch.fzu.edu.cn/jxtz/`,
|
||||||
description: `福州大学教务处教学通知`,
|
description: `福州大学教务处教学通知`,
|
||||||
item: data.map((item) => ({
|
item: data.map((item) => {
|
||||||
|
i++;
|
||||||
|
return {
|
||||||
title: item.title,
|
title: item.title,
|
||||||
description: `${item.title}`,
|
description: `${mains[i]}`,
|
||||||
pubDate: `${item.adddate}`,
|
pubDate: `${item.adddate}`,
|
||||||
link: `${item.url}`,
|
link: `${item.url}`,
|
||||||
})),
|
};
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
const response = await got({
|
const response = await got({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -9,15 +10,57 @@ module.exports = async (ctx) => {
|
|||||||
});
|
});
|
||||||
const data = response.data.data;
|
const data = response.data.data;
|
||||||
|
|
||||||
|
const urls = [];
|
||||||
|
for (const key of data) {
|
||||||
|
urls.push(key.url);
|
||||||
|
};
|
||||||
|
|
||||||
|
const mains = [];
|
||||||
|
for (const key of urls) {
|
||||||
|
const response = await got(key);
|
||||||
|
const data1 = response.data;
|
||||||
|
const $ = cheerio.load(data1);
|
||||||
|
$('.padTB15').remove();
|
||||||
|
$('.c-txt').remove();
|
||||||
|
const main = $('.xl_main');
|
||||||
|
mains.push(main.html());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
const mains = [];
|
||||||
|
await Promise.all(urls.map(async (item) => {
|
||||||
|
console.log(item);
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: item,
|
||||||
|
headers: {
|
||||||
|
Referer: `http://jwch.fzu.edu.cn/jxtz/`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const data1 = response.data;
|
||||||
|
const $ = cheerio.load(data1);
|
||||||
|
$('.padTB15').remove();
|
||||||
|
$('.c-txt').remove();
|
||||||
|
const main = $('.xl_main');
|
||||||
|
console.log(item);
|
||||||
|
mains.push(main.html());
|
||||||
|
return mains;
|
||||||
|
}));
|
||||||
|
*/
|
||||||
|
|
||||||
|
let i = -1;
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: `福州大学教务处专家讲座`,
|
title: `福州大学教务处专家讲座`,
|
||||||
link: `http://jwch.fzu.edu.cn/zjjz/`,
|
link: `http://jwch.fzu.edu.cn/zjjz/`,
|
||||||
description: `福州大学教务处加锡讲坛/信息素养讲座通知`,
|
description: `福州大学教务处加锡讲坛/信息素养讲座通知`,
|
||||||
item: data.map((item) => ({
|
item: data.map((item) => {
|
||||||
|
i++;
|
||||||
|
return {
|
||||||
title: item.title,
|
title: item.title,
|
||||||
description: `${item.title}`,
|
description: `${mains[i]}`,
|
||||||
pubDate: `${item.adddate}`,
|
pubDate: `${item.adddate}`,
|
||||||
link: `${item.url}`,
|
link: `${item.url}`,
|
||||||
})),
|
};
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user