extractus / feed-extractor

Simplest way to read & normalize RSS/ATOM/JSON feed data

Home Page:https://extractor-demos.pages.dev/feed-extractor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] need more fields, want the result can be customized via options

sarike opened this issue · comments

I use this tool to parse rss feed, but there are some fields I need not in the result, such as image, owner.

I want two options extraFeedFields and extraEntryFields used as function, their return value will be merged into the feed and entry fields. So everyone can custom the result.

const feedData = await read('https://some-rss-feed-xml/', {
    extraFeedFields: (channel) {
       return {
          image: channel['itunes:image'],
          owner: channel['iutnes:owner']
      }
   },
})

result:

{
  "title": "xxx",
  "link": "xxx",
  "description": "xxx",
  "language": "",
  "generator": "",
  "published": "",
  "entries": [...],
  "image": {...},
  "owner": {...},
}

@sarike yes, that's smart idea, thank you. I see you forked this repo, are you making a PR for that?

ok, I will have a try.

@sarike thank you, I've merge your pr and release v6.1.2

FYI, I renamed extraFeedFields to getExtraFeedFields and extraEntryFields to getExtraEntryFields.

ok