mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-06 13:08:14 +08:00
58 lines
1.7 KiB
JavaScript
58 lines
1.7 KiB
JavaScript
const axios = require('@/utils/axios');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const type = ctx.params.type;
|
|
const id = ctx.params.id;
|
|
|
|
const res = await axios({
|
|
method: 'get',
|
|
url: `http://www.linkedkeeper.com/list/${type}.action`,
|
|
params: {
|
|
sid: id,
|
|
tid: id,
|
|
},
|
|
});
|
|
const $ = cheerio.load(res.data);
|
|
const list = $('tbody').find('td');
|
|
|
|
ctx.state.data = {
|
|
title: `${$('.blog_en_title')
|
|
.text()
|
|
.trim() ||
|
|
$('.active')
|
|
.text()
|
|
.trim()} - LinkedKeeper`,
|
|
link: res.request.res.responseUrl,
|
|
item: list
|
|
.map((index, item) => {
|
|
item = $(item);
|
|
const pubDate = new Date(
|
|
item
|
|
.find('dd:nth-child(3)')
|
|
.text()
|
|
.trim()
|
|
.replace('月', '-')
|
|
.replace('日', '')
|
|
);
|
|
pubDate.setFullYear(new Date().getFullYear());
|
|
return {
|
|
title: item
|
|
.find('a.blog_weight')
|
|
.text()
|
|
.trim(),
|
|
description: `${item
|
|
.find('a.blog_weight')
|
|
.text()
|
|
.trim()} - ${item
|
|
.find('.blog_author_13')
|
|
.text()
|
|
.trim()}`,
|
|
pubDate: pubDate.toUTCString(),
|
|
link: `http://www.linkedkeeper.com${item.find('a').attr('href')}`,
|
|
};
|
|
})
|
|
.get(),
|
|
};
|
|
};
|