fix(route): MDPI journal - avoid the replace() 'undefined' error (#10022)

This commit is contained in:
Derek
2022-06-23 22:18:55 +08:00
committed by GitHub
parent 47640860ba
commit f7c4a93c4f
+5 -1
View File
@@ -28,7 +28,11 @@ module.exports = async (ctx) => {
const title = $2(item).find('.title-link').text();
const link = `${host}${$2(item).find('.title-link').attr('href')}`;
const authors = $2(item).find('.authors').find('.inlineblock').text();
const doi = $2(item).find('.color-grey-dark').find('a').attr('href').replace('https://doi.org/', '');
const doiLink = $2(item).find('.color-grey-dark').find('a').attr('href');
let doi = '';
if (typeof doiLink !== 'undefined') {
doi = doiLink.replace('https://doi.org/', '');
}
$2(item).find('.abstract-full').find('a').remove();
const abstract = $2(item).find('.abstract-full').text().trim();
const img = `${host}${$2(item).find('.openpopupgallery').find('img').attr('data-src')}`;