fix(route): `pubDate` for `fontstory` (#8069)
This commit is contained in:
parent
8d46760850
commit
d94894be87
|
|
@ -7,19 +7,20 @@ const timezone = require('@/utils/timezone');
|
|||
function getArticle(ctx, list) {
|
||||
const now = list.map((line) =>
|
||||
ctx.cache.tryGet(line, async () => {
|
||||
const a_r = await got.get(`https://www.dynacw.com.tw/fontstory/${line}`);
|
||||
const $ = cheerio.load(a_r.data);
|
||||
const t_r = $('h2.col-xs-12.tc-deeppink').first().text();
|
||||
const articleRaw = await got.get(`https://www.dynacw.com.tw/fontstory/${line}`);
|
||||
const $ = cheerio.load(articleRaw.data);
|
||||
const titleRaw = $('h2.col-xs-12.tc-deeppink').first().text();
|
||||
const tag = $('div.date-txt.col-xs-8.tc-gray').first().text();
|
||||
const timeRaw = $('div.date-txt.col-xs-4.tc-gray.text-right');
|
||||
$('main.container').find('ol.breadcrumb.hidden-xs').remove();
|
||||
$('main.container').find('section.row').first().remove();
|
||||
$('main.container').find('section.pages.row').remove();
|
||||
const desc = $('main.container').html();
|
||||
|
||||
return {
|
||||
title: `${t_r}(${tag})`,
|
||||
title: `${titleRaw}(${tag})`,
|
||||
description: desc,
|
||||
pubDate: timezone(parseDate($('div.date-txt.col-xs-4.tc-gray.text-right').text(), 'YYYY年MM月DD日'), +8),
|
||||
pubDate: timezone(parseDate(timeRaw.text(), 'YYYY年MM月DD日'), +8),
|
||||
link: `https://www.dynacw.com.tw/fontstory/${line}`,
|
||||
};
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue