From 2a24c915cefe567b0da35067d454871d3ba48cbe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 21:34:23 +0000 Subject: [PATCH 1/4] chore(deps-dev): bump nodemon from 3.0.1 to 3.0.2 (#13939) * chore(deps-dev): bump nodemon from 3.0.1 to 3.0.2 Bumps [nodemon](https://github.com/remy/nodemon) from 3.0.1 to 3.0.2. - [Release notes](https://github.com/remy/nodemon/releases) - [Commits](https://github.com/remy/nodemon/compare/v3.0.1...v3.0.2) --- updated-dependencies: - dependency-name: nodemon dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * chore: fix pnpm install --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- pnpm-lock.yaml | 88 ++++++++++++++++++++++++++------------------------ 2 files changed, 46 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 21cd40ceb2c3f7..240c59912167e8 100644 --- a/package.json +++ b/package.json @@ -193,7 +193,7 @@ "lint-staged": "15.1.0", "mockdate": "3.0.5", "nock": "13.4.0", - "nodemon": "3.0.1", + "nodemon": "3.0.2", "prettier": "3.1.0", "remark": "13.0.0", "remark-frontmatter": "3.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c22ec22ac26135..4d308da9596d8e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -332,8 +332,8 @@ devDependencies: specifier: 13.4.0 version: 13.4.0 nodemon: - specifier: 3.0.1 - version: 3.0.1 + specifier: 3.0.2 + version: 3.0.2 prettier: specifier: 3.1.0 version: 3.1.0 @@ -419,7 +419,7 @@ packages: '@babel/traverse': 7.23.2 '@babel/types': 7.23.0 convert-source-map: 2.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -707,7 +707,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.23.0 '@babel/types': 7.23.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -764,7 +764,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) espree: 9.6.1 globals: 13.21.0 ignore: 5.2.4 @@ -786,7 +786,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 2.0.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -1069,7 +1069,7 @@ packages: resolution: {integrity: sha512-ribfPYfHb+Uw3b27Eiw6NPqjhIhTpVFzEWLwyc/1Xp+DCdwRRyIlAUODX+9bPARF6aQtUu1+/PHzdNvRzcs/+Q==} engines: {node: '>= 12'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) http-errors: 2.0.0 koa-compose: 4.1.0 methods: 1.1.2 @@ -1222,7 +1222,7 @@ packages: engines: {node: '>=16.3.0'} hasBin: true dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) extract-zip: 2.0.1 progress: 2.0.3 proxy-agent: 6.3.1 @@ -1885,7 +1885,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -1893,7 +1893,7 @@ packages: resolution: {integrity: sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==} engines: {node: '>= 14'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -2790,7 +2790,7 @@ packages: resolution: {integrity: sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==} dev: false - /debug@3.2.7(supports-color@5.5.0): + /debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: supports-color: '*' @@ -2799,9 +2799,9 @@ packages: optional: true dependencies: ms: 2.1.3 - supports-color: 5.5.0 + dev: false - /debug@4.3.4: + /debug@4.3.4(supports-color@5.5.0): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} peerDependencies: @@ -2811,6 +2811,7 @@ packages: optional: true dependencies: ms: 2.1.2 + supports-color: 5.5.0 /decamelize@1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} @@ -3238,7 +3239,7 @@ packages: peerDependencies: eslint: '>=6.0.0' dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) eslint: 8.54.0 eslint-compat-utils: 0.1.2(eslint@8.54.0) lodash: 4.17.21 @@ -3277,7 +3278,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -3441,7 +3442,7 @@ packages: engines: {node: '>= 10.17.0'} hasBin: true dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: @@ -3797,7 +3798,7 @@ packages: dependencies: basic-ftp: 5.0.3 data-uri-to-buffer: 5.0.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) fs-extra: 8.1.0 transitivePeerDependencies: - supports-color @@ -4125,7 +4126,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -4160,7 +4161,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -4169,7 +4170,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: false @@ -4290,7 +4291,7 @@ packages: bluebird: 3.7.2 chance: 1.1.11 class-transformer: 0.3.1 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) image-size: 0.7.5 json-bigint: 1.0.0 lodash: 4.17.21 @@ -4320,7 +4321,7 @@ packages: dependencies: '@ioredis/commands': 1.2.0 cluster-key-slot: 1.1.2 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) denque: 2.1.0 lodash.defaults: 4.2.0 lodash.isarguments: 3.1.0 @@ -4567,7 +4568,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) istanbul-lib-coverage: 3.2.0 source-map: 0.6.1 transitivePeerDependencies: @@ -5214,7 +5215,7 @@ packages: resolution: {integrity: sha512-rm71jaA/P+6HeCpoRhmCv8KVBIi0tfGuO/dMKicbQnQW/YJntJ6MnnspkodoA4QstMVEZArsCphmd0bJEtoMjQ==} engines: {node: '>= 7.6.0'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) koa-compose: 4.1.0 transitivePeerDependencies: - supports-color @@ -5224,7 +5225,7 @@ packages: resolution: {integrity: sha512-tmcyQ/wXXuxpDxyNXv5yNNkdAMdFRqwtegBXUaowiQzUKqJehttS0x2j0eOZDQAyloAth5w6wwBImnFzkUz3pQ==} engines: {node: '>= 8'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) http-errors: 1.8.1 resolve-path: 1.4.0 transitivePeerDependencies: @@ -5235,7 +5236,7 @@ packages: resolution: {integrity: sha512-UqyYyH5YEXaJrf9S8E23GoJFQZXkBVJ9zYYMPGz919MSX1KuvAcycIuS0ci150HCoPf4XQVhQ84Qf8xRPWxFaQ==} engines: {node: '>= 7.6.0'} dependencies: - debug: 3.2.7(supports-color@5.5.0) + debug: 3.2.7 koa-send: 5.0.1 transitivePeerDependencies: - supports-color @@ -5250,7 +5251,7 @@ packages: content-disposition: 0.5.4 content-type: 1.0.5 cookies: 0.8.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) delegates: 1.0.0 depd: 2.0.0 destroy: 1.2.0 @@ -5358,7 +5359,7 @@ packages: dependencies: chalk: 5.3.0 commander: 11.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) execa: 8.0.1 lilconfig: 2.1.0 listr2: 7.0.2 @@ -5756,7 +5757,7 @@ packages: /micromark@2.11.4: resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) parse-entities: 2.0.0 transitivePeerDependencies: - supports-color @@ -5879,6 +5880,7 @@ packages: /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + dev: false /mz@2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} @@ -5912,7 +5914,7 @@ packages: resolution: {integrity: sha512-W8NVHjO/LCTNA64yxAPHV/K47LpGYcVzgKd3Q0n6owhwvD0Dgoterc25R4rnZbckJEb6Loxz1f5QMuJpJnbSyQ==} engines: {node: '>= 10.13'} dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) json-stringify-safe: 5.0.1 propagate: 2.0.1 transitivePeerDependencies: @@ -5953,13 +5955,13 @@ packages: engines: {node: '>=6.0.0'} dev: false - /nodemon@3.0.1: - resolution: {integrity: sha512-g9AZ7HmkhQkqXkRc20w+ZfQ73cHLbE8hnPbtaFbFtCumZsjyMhKk9LajQ07U5Ux28lvFjZ5X7HvWR1xzU8jHVw==} + /nodemon@3.0.2: + resolution: {integrity: sha512-9qIN2LNTrEzpOPBaWHTm4Asy1LxXLSickZStAQ4IZe7zsoIpD/A7LWxhZV3t4Zu352uBcqVnRsDXSMR2Sc3lTA==} engines: {node: '>=10'} hasBin: true dependencies: chokidar: 3.5.3 - debug: 3.2.7(supports-color@5.5.0) + debug: 4.3.4(supports-color@5.5.0) ignore-by-default: 1.0.1 minimatch: 3.1.2 pstree.remy: 1.1.8 @@ -6195,7 +6197,7 @@ packages: dependencies: '@tootallnate/quickjs-emscripten': 0.23.0 agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) get-uri: 6.0.1 http-proxy-agent: 7.0.0 https-proxy-agent: 7.0.2 @@ -6473,7 +6475,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) http-proxy-agent: 7.0.0 https-proxy-agent: 7.0.2 lru-cache: 7.18.3 @@ -6524,7 +6526,7 @@ packages: '@puppeteer/browsers': 1.8.0 chromium-bidi: 0.4.33(devtools-protocol@0.0.1203626) cross-fetch: 4.0.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) devtools-protocol: 0.0.1203626 ws: 8.14.2 transitivePeerDependencies: @@ -6546,7 +6548,7 @@ packages: puppeteer-extra: optional: true dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) puppeteer-extra: 3.3.6(puppeteer@21.5.2) puppeteer-extra-plugin: 3.2.3(puppeteer-extra@3.3.6) puppeteer-extra-plugin-user-preferences: 2.4.1(puppeteer-extra@3.3.6) @@ -6566,7 +6568,7 @@ packages: puppeteer-extra: optional: true dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) fs-extra: 10.1.0 puppeteer-extra: 3.3.6(puppeteer@21.5.2) puppeteer-extra-plugin: 3.2.3(puppeteer-extra@3.3.6) @@ -6587,7 +6589,7 @@ packages: puppeteer-extra: optional: true dependencies: - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) deepmerge: 4.3.1 puppeteer-extra: 3.3.6(puppeteer@21.5.2) puppeteer-extra-plugin: 3.2.3(puppeteer-extra@3.3.6) @@ -6609,7 +6611,7 @@ packages: optional: true dependencies: '@types/debug': 4.1.8 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) merge-deep: 3.0.3 puppeteer-extra: 3.3.6(puppeteer@21.5.2) transitivePeerDependencies: @@ -6632,7 +6634,7 @@ packages: optional: true dependencies: '@types/debug': 4.1.8 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) deepmerge: 4.3.1 puppeteer: 21.5.2 transitivePeerDependencies: @@ -7184,7 +7186,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) socks: 2.7.1 transitivePeerDependencies: - supports-color @@ -7384,7 +7386,7 @@ packages: dependencies: component-emitter: 1.3.0 cookiejar: 2.1.4 - debug: 4.3.4 + debug: 4.3.4(supports-color@5.5.0) fast-safe-stringify: 2.1.1 form-data: 4.0.0 formidable: 2.1.2 From bcb21cf5cd7d92b55ae5f74e1da942be1996d795 Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Sat, 2 Dec 2023 23:02:30 +0800 Subject: [PATCH 2/4] feat(route/cna): Preserve web crawling method. (#13531) * feat(route/cna): Preserve web crawling method. * Add doc. * . * Update website/docs/routes/traditional-media.mdx --------- --- lib/v2/cna/maintainer.js | 1 + lib/v2/cna/radar.js | 6 +++ lib/v2/cna/router.js | 1 + lib/v2/cna/web/index.js | 62 +++++++++++++++++++++++ website/docs/routes/traditional-media.mdx | 4 ++ 5 files changed, 74 insertions(+) create mode 100644 lib/v2/cna/web/index.js diff --git a/lib/v2/cna/maintainer.js b/lib/v2/cna/maintainer.js index 77e7f46e2f9997..25c21691da0802 100644 --- a/lib/v2/cna/maintainer.js +++ b/lib/v2/cna/maintainer.js @@ -1,3 +1,4 @@ module.exports = { '/:id?': ['nczitzk'], + '/web/:id?': ['dzx-dzx'], }; diff --git a/lib/v2/cna/radar.js b/lib/v2/cna/radar.js index 92cec6d1b42db5..5431d1dc9ba66d 100644 --- a/lib/v2/cna/radar.js +++ b/lib/v2/cna/radar.js @@ -8,6 +8,12 @@ module.exports = { source: ['/list/:id', '/topic/newstopic/:id'], target: (params) => `/cna/${params.id.replace('.aspx', '')}`, }, + { + title: '分类(网页爬虫方法)', + docs: 'https://docs.rsshub.app/routes/traditional-media#zhong-yang-tong-xun-she', + source: ['/list/:id'], + target: (params) => `/cna/web/${params.id.replace('.aspx', '')}`, + }, ], }, }; diff --git a/lib/v2/cna/router.js b/lib/v2/cna/router.js index a5d65c468f4c46..a8cb0cb48e1347 100644 --- a/lib/v2/cna/router.js +++ b/lib/v2/cna/router.js @@ -1,3 +1,4 @@ module.exports = (router) => { router.get('/:id?', require('./')); + router.get('/web/:id?', require('./web/')); }; diff --git a/lib/v2/cna/web/index.js b/lib/v2/cna/web/index.js new file mode 100644 index 00000000000000..e050d672b9f2be --- /dev/null +++ b/lib/v2/cna/web/index.js @@ -0,0 +1,62 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); + +module.exports = async (ctx) => { + const id = ctx.params.id || 'aall'; + + let rootUrl; + + if (/^\d+$/.test(id)) { + rootUrl = `https://www.cna.com.tw/topic/newstopic/${id}.aspx`; + } else { + rootUrl = `https://www.cna.com.tw/list/${id}.aspx`; + } + const response = await got({ + method: 'get', + url: rootUrl, + }); + + const $ = cheerio.load(response.data); + const list = $('*:is(.pcBox .caItem, .mainList li a div) h2') + .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 10) + .toArray() + .map((item) => { + item = $(item); + return { + title: item.text(), + link: item.parents('a').attr('href'), + pubDate: timezone(parseDate(item.next().text()), +8), + }; + }); + + const items = await Promise.all( + list.map((item) => + ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + const topImage = content('.fullPic').html(); + + item.description = (topImage === null ? '' : topImage) + content('.paragraph').eq(0).html(); + item.category = [ + ...content("meta[property='article:tag']") + .get() + .map((e) => e.attribs.content), + content('.active > a').text(), + ]; + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: rootUrl, + item: items, + }; +}; diff --git a/website/docs/routes/traditional-media.mdx b/website/docs/routes/traditional-media.mdx index 8b3326323adcc6..cdf4d78c5be15b 100644 --- a/website/docs/routes/traditional-media.mdx +++ b/website/docs/routes/traditional-media.mdx @@ -2831,6 +2831,10 @@ category 对应的关键词有 +### 分类(网页爬虫方法) {#zhong-yang-tong-xun-she-fen-lei-wang-ye-pa-chong-fang-fa} + + + ## 组织人事报 {#zu-zhi-ren-shi-bao} ### 电子报 {#zu-zhi-ren-shi-bao-dian-zi-bao} From ea24778c47cc4edde33d1dab9fc6d284a3b70049 Mon Sep 17 00:00:00 2001 From: Tony Date: Sat, 2 Dec 2023 23:17:42 +0800 Subject: [PATCH 3/4] docs: fix URL encoding in website components --- .../i18n/zh/docusaurus-plugin-content-docs/current/README.md | 2 +- website/src/components/InstanceList.tsx | 2 +- website/src/components/Route.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md b/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md index ddcfe73cc67900..40e31909368f5d 100644 --- a/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current/README.md @@ -31,7 +31,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以

- +

[![](https://opencollective.com/static/images/become_sponsor.svg)](/zh/support/) diff --git a/website/src/components/InstanceList.tsx b/website/src/components/InstanceList.tsx index 444ed8485bf40b..f302aab0eaf8dc 100644 --- a/website/src/components/InstanceList.tsx +++ b/website/src/components/InstanceList.tsx @@ -66,7 +66,7 @@ export default function InstanceList(): JSX.Element { ) : 'Anonymous'} - + ))} diff --git a/website/src/components/Route.tsx b/website/src/components/Route.tsx index e1ec6c5085fad5..bdaea8ef9e96e7 100644 --- a/website/src/components/Route.tsx +++ b/website/src/components/Route.tsx @@ -76,7 +76,7 @@ export default function Route({ {demoUrl} - +

{path} From 082bb3d847480c481a839cbe7aa433b337273231 Mon Sep 17 00:00:00 2001 From: Fatpandac Date: Sat, 2 Dec 2023 23:18:29 +0800 Subject: [PATCH 4/4] fix(route): did no match the version and date (#13942) * fix(route): did no match the version and date * Update latest.js * Update latest.js --------- --- lib/v2/brave/latest.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/v2/brave/latest.js b/lib/v2/brave/latest.js index 4072a2ea999ef9..8e33c6e56baee5 100644 --- a/lib/v2/brave/latest.js +++ b/lib/v2/brave/latest.js @@ -20,13 +20,15 @@ module.exports = async (ctx) => { const title = item.text(); const device = item.parent().find('h2').text(); + const matchVersion = title.match(/(v[\d.]+)/); + const matchDate = title.match(/\((.*?)\)/); return { title: `[${device}] ${title}`, link: currentUrl, - guid: `${currentUrl}#${device}-${title.match(/(v[\d.]+)/)[1]}`, + guid: `${currentUrl}#${device}-${matchVersion?.[1] ?? title}`, description: item.next().html(), - pubDate: parseDate(title.match(/\((.*?)\)/)[1].replace(/(st|nd|rd|th)?,/, ''), ['MMMM D YYYY', 'MMM D YYYY']), + pubDate: parseDate(matchDate?.[1].replace(/(st|nd|rd|th)?,/, ''), ['MMMM D YYYY', 'MMM D YYYY']), }; });