From e6f5642fae02e403144308a9151f7b176c46d6d1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2019 12:39:18 +0000 Subject: [PATCH 1/4] chore(deps-dev): bump nodemon from 1.19.1 to 1.19.2 Bumps [nodemon](https://github.com/remy/nodemon) from 1.19.1 to 1.19.2. - [Release notes](https://github.com/remy/nodemon/releases) - [Commits](https://github.com/remy/nodemon/compare/v1.19.1...v1.19.2) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 6d91e7169a..167b889186 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "jest": "24.9.0", "mockdate": "2.0.5", "nock": "11.3.2", - "nodemon": "1.19.1", + "nodemon": "1.19.2", "pinyin": "2.9.0", "prettier": "1.18.2", "prettier-check": "2.0.0", diff --git a/yarn.lock b/yarn.lock index bfe35ed14e..c469abda0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7458,10 +7458,10 @@ nodemailer@6.1.1: resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.1.1.tgz#09e88ef4b3646f01089c5d84d007b872141fb575" integrity sha1-CeiO9LNkbwEInF2E0Ae4chQftXU= -nodemon@1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.19.1.tgz#576f0aad0f863aabf8c48517f6192ff987cd5071" - integrity sha512-/DXLzd/GhiaDXXbGId5BzxP1GlsqtMGM9zTmkWrgXtSqjKmGSbLicM/oAy4FR0YWm14jCHRwnR31AHS2dYFHrg== +nodemon@1.19.2: + version "1.19.2" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.19.2.tgz#b0975147dc99b3761ceb595b3f9277084931dcc0" + integrity sha512-hRLYaw5Ihyw9zK7NF+9EUzVyS6Cvgc14yh8CAYr38tPxJa6UrOxwAQ351GwrgoanHCF0FalQFn6w5eoX/LGdJw== dependencies: chokidar "^2.1.5" debug "^3.1.0" From c2d94c48c06973adf19c74ca4ea19052ba1483fc Mon Sep 17 00:00:00 2001 From: Cloud Date: Tue, 3 Sep 2019 23:10:18 +0800 Subject: [PATCH 2/4] fix: douban people status (#2989) --- lib/routes/douban/people/status.js | 38 +++++++++++++++++++----------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/lib/routes/douban/people/status.js b/lib/routes/douban/people/status.js index 0b58c3feeb..a87137b334 100644 --- a/lib/routes/douban/people/status.js +++ b/lib/routes/douban/people/status.js @@ -12,11 +12,18 @@ function getContentByActivity(status) { }); break; case '转发': - description = getContentByActivity(status.reshared_status).title; - title = `${status.author.name} ${status.activity} ${status.reshared_status.author.name} 的广播:${status.reshared_status.text}`; - status.reshared_status.images.forEach((image) => { - description += `

`; - }); + description = `${status.text}
`; + if (status.reshared_status.deleted) { + title = `${status.author.name} ${status.activity} 广播:原动态已被发布者删除`; + description += `原动态已被发布者删除`; + } else { + description += getContentByActivity(status.reshared_status).title; + title = `${status.author.name} ${status.activity} ${status.reshared_status.author.name} 的广播:${status.reshared_status.text}`; + status.reshared_status.images.forEach((image) => { + description += `

`; + }); + } + break; default: if (status.card) { @@ -44,19 +51,22 @@ module.exports = async (ctx) => { Referer: `https://m.douban.com/people/${userid}/statuses`, }, }); + const items = response.data.items; ctx.state.data = { title: `豆瓣广播-${userid}`, link: `https://m.douban.com/people/${userid}/statuses`, - item: items.map((item) => { - const r = getContentByActivity(item.status); - return { - title: r.title, - link: item.status.sharing_url, - pubDate: item.status.create_time, - description: r.description, - }; - }), + item: items + .filter((item) => !item.deleted) + .map((item) => { + const r = getContentByActivity(item.status); + return { + title: r.title, + link: item.status.sharing_url, + pubDate: item.status.create_time, + description: r.description, + }; + }), }; }; From d2fa61a8ecc9589cacbb0821f02961d65bd4d0c5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2019 16:17:09 +0000 Subject: [PATCH 3/4] chore(deps-dev): bump eslint-config-prettier from 6.1.0 to 6.2.0 Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.1.0 to 6.2.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.1.0...v6.2.0) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 167b889186..8f2da4f39f 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@vuepress/plugin-pwa": "1.0.3", "cross-env": "5.2.1", "eslint": "6.3.0", - "eslint-config-prettier": "6.1.0", + "eslint-config-prettier": "6.2.0", "eslint-plugin-prettier": "3.1.0", "jest": "24.9.0", "mockdate": "2.0.5", diff --git a/yarn.lock b/yarn.lock index c469abda0f..e214172d1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3896,10 +3896,10 @@ escodegen@^1.8.1, escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" -eslint-config-prettier@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.1.0.tgz#e6f678ba367fbd1273998d5510f76f004e9dce7b" - integrity sha512-k9fny9sPjIBQ2ftFTesJV21Rg4R/7a7t7LCtZVrYQiHEp8Nnuk3EGaDmsKSAnsPj0BYcgB2zxzHa2NTkIxcOLg== +eslint-config-prettier@6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.2.0.tgz#80e0b8714e3f6868c4ac2a25fbf39c02e73527a7" + integrity sha512-VLsgK/D+S/FEsda7Um1+N8FThec6LqE3vhcMyp8mlmto97y3fGf3DX7byJexGuOb1QY0Z/zz222U5t+xSfcZDQ== dependencies: get-stdin "^6.0.0" From c859291ca3812d99e4b84201733e0447f4f33f26 Mon Sep 17 00:00:00 2001 From: Cloud Date: Wed, 4 Sep 2019 11:41:05 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20if=20fulltext=20parser=20failed,=20r?= =?UTF-8?q?eturn=20default=20description=20and=E2=80=A6=20(#2992)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/middleware/parameter.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/middleware/parameter.js b/lib/middleware/parameter.js index 3a2117a936..27e87d62b9 100644 --- a/lib/middleware/parameter.js +++ b/lib/middleware/parameter.js @@ -19,16 +19,21 @@ module.exports = async (ctx, next) => { const tasks = ctx.state.data.item.map(async (item) => { const { link, author, description } = item; const parsed_result = await ctx.cache.tryGet(`mercury-cache-${link}`, async () => { - const res = await got(link); - const $ = cheerio.load(res.data); - const result = await mercury_parser.parse(link, { - html: $.html(), - }); - return result; + // if parser failed, return default description and not report error + try { + const res = await got(link); + const $ = cheerio.load(res.data); + const result = await mercury_parser.parse(link, { + html: $.html(), + }); + return result; + } catch (e) { + // no-empty + } }); - item.author = author || parsed_result.author; - item.description = parsed_result.content || description; + item.author = author || (parsed_result ? parsed_result.author : ''); + item.description = parsed_result ? parsed_result.content : description; }); await Promise.all(tasks); }