extractus / feed-extractor

Simplest way to read & normalize RSS/ATOM/JSON feed data
https://extractor-demos.pages.dev/feed-extractor
MIT License
167 stars 33 forks source link

When feed level links are relative the baseUrl option is not applied #135

Open WetHat opened 5 months ago

WetHat commented 5 months ago

The attached feed uses relative links like so (see also the attached feed XML). The feed level link looks like this:

<link>/blog/</link>

The feed extractor returns this link as is, and does not use the baseUrl property provided with parsing options. While using relative links in RSS feed is highly questionable, the extractor should use the baseUrl on the feed level too.

This issue can be worked around by providing custom processing like so:

if (link) {
    this.site = link.startsWith("/") && options.baseUrl ? options.baseUrl + link : link;
}

feed.zip

ndaidong commented 5 months ago

Yes, thank you for you notice. It should cover this case.