From 0fef19aaabf4d0eba3b812890da8314142478db2 Mon Sep 17 00:00:00 2001 From: qiin Date: Tue, 13 Jun 2023 12:47:09 +0800 Subject: [PATCH] fix: rog ally --- main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index b4d0438..b798a8b 100644 --- a/main.js +++ b/main.js @@ -542,9 +542,13 @@ export default class MonkeyMaster { referer: `https://item.jd.com/${skuId}.html`, headers: this.headers, }); - // await logger.info(await res.text()) - const retJson = str2Json(await res.text()); - return retJson['url'] ? 'https:' + retJson['url'] : ''; + + let ret = ''; + try { + const resObj = str2Json(await res.text()); + ret = resObj['url'] ? 'https:' + resObj['url'] : ''; + } catch (error) {} + return ret; } /**