From af1b9b0ef6aa755c29f11353ad4d2a8ca686706f Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 4 Jan 2023 11:10:01 +0700 Subject: [PATCH] v6.1.9 - Fix problem with some rss sources those provide only `id` instead of `link` - Update dependencies - Update docs --- CONTRIBUTING.md | 15 --------------- README.md | 1 + dist/cjs/feed-extractor.js | 7 +++++-- dist/cjs/package.json | 2 +- dist/feed-extractor.esm.js | 7 +++++-- package.json | 4 ++-- src/utils/normalizer.js | 3 +++ src/utils/parseRssFeed.js | 2 +- 8 files changed, 18 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9287ae8..f95b707 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,21 +7,6 @@ Collaborations and pull requests are always welcomed, though larger proposals sh As an OSS, it's better to follow the Unix philosophy: "do one thing and do it well". -## What you can contribute? - -We are planing to re-write this tool in TypeScript and make it Deno-first library. -If you are interested, please join our team. - -Besides that, you can also: - -- Test and report bugs -- Fix unresolved issues -- Improve performance -- Write better documentation -- Create examples or build demos -- Feedback on software design and APIs - - ## Third-party libraries Please avoid using libaries other than those available in the standard library, unless necessary. diff --git a/README.md b/README.md index 1959aaa..a10deaf 100755 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ Without any options, the result should have the following structure: published: ISO Date String, entries: Array[ { + id: String, title: String, link: String, description: String, diff --git a/dist/cjs/feed-extractor.js b/dist/cjs/feed-extractor.js index a1275b9..4761ed5 100644 --- a/dist/cjs/feed-extractor.js +++ b/dist/cjs/feed-extractor.js @@ -1,4 +1,4 @@ -// @extractus/feed-extractor@6.1.8, by @extractus - built with esbuild at 2022-12-30T05:55:09.972Z - published under MIT license +// @extractus/feed-extractor@6.1.9, by @extractus - built with esbuild at 2023-01-04T04:09:49.802Z - published under MIT license var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -4882,6 +4882,9 @@ var getLink = (val = [], id = "") => { if (id && isValid(id)) { return id; } + if (isObject(id) && hasProperty(id, "@_isPermaLink") && Boolean(id["@_isPermaLink"]) === true) { + return getText(id); + } const getEntryLink = (links) => { const items = links.map((item) => { return getLink(item); @@ -5012,7 +5015,7 @@ var transform2 = (item, options) => { const entry = { id: getEntryId(guid, link, pubDate), title: getText(title), - link: getPureUrl(link), + link: getPureUrl(link, guid), published, description: buildDescription(description, descriptionMaxLen) }; diff --git a/dist/cjs/package.json b/dist/cjs/package.json index ee38fc0..82847f8 100644 --- a/dist/cjs/package.json +++ b/dist/cjs/package.json @@ -1,5 +1,5 @@ { "name": "@extractus/feed-extractor", - "version": "6.1.8", + "version": "6.1.9", "main": "./feed-extractor.js" } \ No newline at end of file diff --git a/dist/feed-extractor.esm.js b/dist/feed-extractor.esm.js index 50094e8..debe584 100644 --- a/dist/feed-extractor.esm.js +++ b/dist/feed-extractor.esm.js @@ -1,4 +1,4 @@ -// @extractus/feed-extractor@6.1.8, by @extractus - built with esbuild at 2022-12-30T05:55:09.972Z - published under MIT license +// @extractus/feed-extractor@6.1.9, by @extractus - built with esbuild at 2023-01-04T04:09:49.802Z - published under MIT license var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -2003,6 +2003,9 @@ var getLink = (val = [], id = "") => { if (id && isValid(id)) { return id; } + if (isObject(id) && hasProperty(id, "@_isPermaLink") && Boolean(id["@_isPermaLink"]) === true) { + return getText(id); + } const getEntryLink = (links) => { const items = links.map((item) => { return getLink(item); @@ -2133,7 +2136,7 @@ var transform2 = (item, options) => { const entry = { id: getEntryId(guid, link, pubDate), title: getText(title), - link: getPureUrl(link), + link: getPureUrl(link, guid), published, description: buildDescription(description, descriptionMaxLen) }; diff --git a/package.json b/package.json index 0ce737c..8ca4a36 100755 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "6.1.8", + "version": "6.1.9", "name": "@extractus/feed-extractor", "description": "To read and normalize RSS/ATOM/JSON feed data", "homepage": "https://github.com/extractus/feed-extractor", @@ -40,7 +40,7 @@ "html-entities": "^2.3.3" }, "devDependencies": { - "esbuild": "^0.16.12", + "esbuild": "^0.16.13", "jest": "^29.3.1", "nock": "^13.2.9", "standard": "^17.0.0" diff --git a/src/utils/normalizer.js b/src/utils/normalizer.js index 58b3bda..b3f4bbe 100644 --- a/src/utils/normalizer.js +++ b/src/utils/normalizer.js @@ -35,6 +35,9 @@ export const getLink = (val = [], id = '') => { if (id && isValidUrl(id)) { return id } + if (isObject(id) && hasProperty(id, '@_isPermaLink') && Boolean(id['@_isPermaLink']) === true) { + return getText(id) + } const getEntryLink = (links) => { const items = links.map((item) => { return getLink(item) diff --git a/src/utils/parseRssFeed.js b/src/utils/parseRssFeed.js index 22271e6..b117d7f 100644 --- a/src/utils/parseRssFeed.js +++ b/src/utils/parseRssFeed.js @@ -33,7 +33,7 @@ const transform = (item, options) => { const entry = { id: getEntryId(guid, link, pubDate), title: getText(title), - link: getPureUrl(link), + link: getPureUrl(link, guid), published, description: buildDescription(description, descriptionMaxLen) }