feat: better reading experience for nyt & solidot (#6042)
This commit is contained in:
@@ -82,7 +82,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const result = utils.ProcessFeed(response, hasEnVersion);
|
||||
|
||||
single.description = result.description;
|
||||
const matching = '<div class="article-paragraph">';
|
||||
const formatted = '<p></p>' + matching;
|
||||
|
||||
single.description = result.description.split(matching).join(formatted);
|
||||
|
||||
if (hasEnVersion) {
|
||||
single.title = result.title;
|
||||
|
||||
@@ -32,13 +32,21 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
|
||||
item.pubDate = result.pubDate;
|
||||
item.description = result.description;
|
||||
|
||||
// Match 感谢|謝.*?cn.letters@nytimes.com。
|
||||
const ending = /感(谢|謝);.*?cn\.letters@nytimes\.com。/g;
|
||||
|
||||
const matching = '<div class="article-paragraph">';
|
||||
const formatted = '<p></p>' + matching;
|
||||
|
||||
item.description = result.description.replace(ending, '').split(matching).join(formatted);
|
||||
|
||||
return Promise.resolve(item);
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '纽约时报 每日简报',
|
||||
title: '纽约时报中文网|每日简报',
|
||||
link: url,
|
||||
item: items,
|
||||
};
|
||||
|
||||
@@ -37,6 +37,7 @@ module.exports = async function get_article(url) {
|
||||
link: url,
|
||||
description: $('div.p_mainnew')
|
||||
.html()
|
||||
.replace(/(href.*?)<u>(.*?)<\/u>/g, `$1$2`)
|
||||
.replace(/href="\//g, 'href="' + domain + '/'),
|
||||
category: $('div.icon_float > a').attr('title'),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user