githubEdit

RSS

Reads RSS feed from given URL(s) and returns structured feed data with items and channel metadata.

Method Signature

RSS( urls, [filter], [maxItems], [itunes], [mediaRss], [userAgent], [timeout] )

Arguments

Argument
Type
Required
Description
Default

urls

string or array

Yes

URL or Array of URLs to read RSS feed from. Can be http(s) URLs or local file paths (file:/path/to/file)

filter

function

No

A filter closure/lambda to filter feed items by certain criteria

(i) -> true

maxItems

numeric

No

Maximum number of items to return (0 = unlimited)

0

itunes

boolean

No

Parse iTunes podcast extensions

false

mediaRss

boolean

No

Parse Media RSS extensions for video/audio thumbnails

false

userAgent

string

No

Custom User-Agent string for HTTP requests

""

timeout

numeric

No

Timeout in seconds for HTTP requests

25

Examples

Basic RSS Feed Reading

// Read a simple RSS feed
feedData = RSS( "https://example.com/feed.xml" );

println( "Feed Title: " & feedData.channel.title );
println( "Found " & feedData.items.size() & " items" );

// Display first few items
feedData.items.each( ( item, index ) => {
    if ( index <= 3 ) {
        println( "- " & item.title );
        println( "  " & item.link );
    }
} );

Reading Multiple Feeds

Using Filters and Limits

Reading Podcast Feeds with iTunes Extensions

Reading Media RSS with Thumbnails

Custom HTTP Settings

Local File Reading

Return Value

The function returns a struct with two main keys:

items (Array)

Array of feed items, each containing:

  • title - Item title

  • link - Item URL

  • description - Item description/content

  • pubDate - Publication date

  • author - Item author

  • categories - Array of categories

  • guid - Unique identifier

  • Additional fields based on feed type and extensions

channel (Struct)

Feed metadata containing:

  • title - Feed title

  • link - Feed URL

  • description - Feed description

  • language - Feed language

  • lastBuildDate - Last update date

  • generator - Feed generator software

  • Additional fields based on feed type and extensions

iTunes Extension Fields

When itunes=true, additional fields are available:

Channel Fields:

  • itunesAuthor - Podcast author

  • itunesCategory - Podcast category

  • itunesImage - Podcast artwork URL

  • itunesExplicit - Explicit content flag

  • itunesSubtitle - Podcast subtitle

Item Fields:

  • itunesAuthor - Episode author

  • itunesDuration - Episode duration

  • itunesExplicit - Episode explicit flag

  • itunesSummary - Episode summary

  • itunesTitle - Episode title

Media RSS Extension Fields

When mediaRss=true, additional fields are available:

Item Fields:

  • mediaThumbnailUrl - Thumbnail image URL

  • mediaContentUrl - Media file URL

  • mediaContentType - Media MIME type

  • mediaPlayerUrl - Media player URL

  • Feed Component - Full-featured component for reading and creating RSS/Atom feeds

Last updated

Was this helpful?