fix: change ftchinese cover URL & remove comments elements (#4176)

This commit is contained in:
hoilc
2020-03-08 01:16:16 +08:00
committed by GitHub
parent d76ea0936a
commit b6b1cf3d45

View File

@@ -8,7 +8,7 @@ const ProcessFeed = ($, link) => {
// 处理封面图片 // 处理封面图片
content.find('div.story-image > figure').each((i, e) => { content.find('div.story-image > figure').each((i, e) => {
const src = `https://www.ft.com/__origami/service/image/v2/images/raw/${encodeURIComponent(e.attribs['data-url'])}?source=ftchinese&width=800&fit=cover`; const src = `https://thumbor.ftacademy.cn/unsafe/1340x754/${e.attribs['data-url']}`;
$(`<img src=${src}>`).insertAfter(content.find('div.story-lead')[0]); $(`<img src=${src}>`).insertAfter(content.find('div.story-lead')[0]);
}); });
@@ -27,9 +27,13 @@ const ProcessFeed = ($, link) => {
author = author.trim(); author = author.trim();
// 去除头部主题, 头部重复标题, 冗余元数据, 植入广告, 植入 js, 社交分享按钮, 底部版权声明, 空白 DOM // 去除头部主题, 头部重复标题, 冗余元数据, 植入广告, 植入 js, 社交分享按钮, 底部版权声明, 空白 DOM
content.find('div.story-theme, h1.story-headline, div.story-byline, div.mpu-container-instory,script, div#story-action-placeholder, div.copyrightstatement-container, div.clearfloat, div.o-ads').each((i, e) => { content
$(e).remove(); .find(
}); 'div.story-theme, h1.story-headline, div.story-byline, div.mpu-container-instory,script, div#story-action-placeholder, div.copyrightstatement-container, div.clearfloat, div.o-ads, h2.list-title, div.allcomments, div.logincomment, div.nologincomment'
)
.each((i, e) => {
$(e).remove();
});
content = content.html(); content = content.html();
return { content, author, title }; return { content, author, title };