diff --git a/lib/tajian.mjs b/lib/tajian.mjs index 153c517..e4dd58d 100644 --- a/lib/tajian.mjs +++ b/lib/tajian.mjs @@ -45,6 +45,7 @@ class TaJian { let content = data.title; await writeFile(filepath, content, { encoding: 'utf8' }); + //save cover image if (typeof(data.cover_base64) != 'undefined' && data.cover_base64) { filepath = `${dirPath}/${filename}.${data.cover_type}`; content = Buffer.from(data.cover_base64, "base64"); //保存图片文件 @@ -53,7 +54,7 @@ class TaJian { filepath = `${dirPath}/${filename}_cover.txt`; content = `${filename}.${data.cover_type}`; //保存图片路径 await writeFile(filepath, content, { encoding: 'utf8' }); - }else { + }else if (typeof(data.cover) != 'undefined' && data.cover) { filepath = `${dirPath}/${filename}_cover.txt`; content = data.cover; //保存图片网址 await writeFile(filepath, content, { encoding: 'utf8' });