fix: 才府社区用户动态链接 (#5607)
Co-authored-by: codefactor-io <support@codefactor.io>
This commit is contained in:
parent
23e78dda49
commit
def39c915a
|
|
@ -7,17 +7,32 @@ module.exports = async (ctx) => {
|
|||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('div.dynamic-single')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
|
||||
const word = item.find('div.word');
|
||||
const detailTitle = item.find('p.detail-title').text();
|
||||
|
||||
let link = currentUrl;
|
||||
let title = detailTitle || word.html();
|
||||
|
||||
if (word.attr('onclick')) {
|
||||
link = `https://sns.91ddcc.com${word.attr('onclick').split("'")[1]}`;
|
||||
} else {
|
||||
title = item.find('div.fl').text().trim();
|
||||
}
|
||||
|
||||
item.find('p.detail-title').remove();
|
||||
|
||||
return {
|
||||
title: item.find('div.detail-time').text(),
|
||||
link: `https://sns.91ddcc.com/${item.attr('id').split('-')[1]}`,
|
||||
description: word.html(),
|
||||
pubDate: new Date(item.find('div.detail-time').text() + ' GMT+8').toUTCString(),
|
||||
title: title,
|
||||
link: link,
|
||||
description: item.find('div.dynamic-content').html(),
|
||||
pubDate: new Date(item.attr('add-time') * 1000).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
|
|
|||
Loading…
Reference in New Issue