fix pocket trending (#5221)
This commit is contained in:
parent
90030ec017
commit
9dbe56b22c
|
|
@ -7,19 +7,24 @@ module.exports = async (ctx) => {
|
|||
const response = await got.get(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('.item').toArray();
|
||||
|
||||
const list = $('article').get();
|
||||
ctx.state.data = {
|
||||
title: 'Trending on Pocket',
|
||||
description: 'Top Articles and Videos about Trending on Pocket',
|
||||
link: url,
|
||||
item: list.map((item) => {
|
||||
item = $(item);
|
||||
const middle_link = new URL(item.find('a').first().attr('href'));
|
||||
const media = item
|
||||
.find('.media')
|
||||
.attr('style')
|
||||
.match(/url\('(.*?)'\);/)[1];
|
||||
const pic_html = media ? `<img src="${media}">` : '';
|
||||
return {
|
||||
title: item.find('.title').text(),
|
||||
author: item.find('.domain > a').text(),
|
||||
description: `<p>${item.find('.excerpt').text()}</p><img src="${item.find('.item_image').attr('data-thumburl')}" />`,
|
||||
link: item.find('.item_link').attr('data-saveurl'),
|
||||
author: item.find('.details > span').first().text(),
|
||||
description: `<p>${item.find('.excerpt').text()}</p>` + pic_html,
|
||||
link: middle_link.searchParams.get('url') || middle_link.href,
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue