@robinpath/feed
0.1.1Node.jsPublicRSS, Atom, and JSON Feed creation, parsing, manipulation, and auto-detection
Feed
RSS, Atom, and JSON Feed creation, parsing, manipulation, and auto-detection
Package: @robinpath/feed | Category: Web | Type: Utility
Authentication
No authentication required. All functions are available immediately.
Use Cases
Use the feed module when you need to:
- Create RSS 2.0 feed -- Use
feed.createRssto perform this operation - Create Atom feed -- Use
feed.createAtomto perform this operation - Create JSON Feed -- Use
feed.createJsonto perform this operation - Parse RSS feed -- Use
feed.parseRssto perform this operation - Parse Atom feed -- Use
feed.parseAtomto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
createRss | Create RSS 2.0 feed | RSS XML |
createAtom | Create Atom feed | Atom XML |
createJson | Create JSON Feed | JSON Feed string |
parseRss | Parse RSS feed | {type, title, link, items[]} |
parseAtom | Parse Atom feed | {type, title, link, items[]} |
parseJson | Parse JSON Feed | {type, title, link, items[]} |
detect | Detect feed format | `rss |
parse | Auto-detect and parse any feed | {type, title, link, items[]} |
addItem | Add item to feed config | Updated config |
removeItem | Remove item by guid | Updated config |
sortItems | Sort items by date | Sorted items |
filterItems | Filter items by field regex | Matching items |
mergeFeeds | Merge multiple feeds | Merged feed config |
fetch | Fetch and parse feed from URL | {ok, status, feed} |
Functions
createRss
Create RSS 2.0 feed
Module: feed | Returns: string -- RSS XML
feed.createRss {"title": "My Blog", "link": "https://example.com", "items": [...]}
| Parameter | Type | Required | Description |
|---|---|---|---|
config | object | Yes | {title, link, description, language, items[]} |
createAtom
Create Atom feed
Module: feed | Returns: string -- Atom XML
feed.createAtom {"title": "My Blog", "link": "https://example.com", "items": [...]}
| Parameter | Type | Required | Description |
|---|---|---|---|
config | object | Yes | {title, link, description, items[]} |
createJson
Create JSON Feed
Module: feed | Returns: string -- JSON Feed string
feed.createJson {"title": "My Blog", "items": [...]}
| Parameter | Type | Required | Description |
|---|---|---|---|
config | object | Yes | {title, link, description, items[]} |
parseRss
Parse RSS feed
Module: feed | Returns: object -- {type, title, link, items[]}
feed.parseRss $xml
| Parameter | Type | Required | Description |
|---|---|---|---|
xml | string | Yes | RSS XML |
parseAtom
Parse Atom feed
Module: feed | Returns: object -- {type, title, link, items[]}
feed.parseAtom $xml
| Parameter | Type | Required | Description |
|---|---|---|---|
xml | string | Yes | Atom XML |
parseJson
Parse JSON Feed
Module: feed | Returns: object -- {type, title, link, items[]}
feed.parseJson $json
| Parameter | Type | Required | Description |
|---|---|---|---|
json | string | Yes | JSON Feed |
detect
Detect feed format
Module: feed | Returns: string -- rss | atom | json | unknown
feed.detect $content
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Feed content |
parse
Auto-detect and parse any feed
Module: feed | Returns: object -- {type, title, link, items[]}
feed.parse $content
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Feed content |
addItem
Add item to feed config
Module: feed | Returns: object -- Updated config
feed.addItem $config {"title": "New Post", "link": "..."}
| Parameter | Type | Required | Description |
|---|---|---|---|
config | object | Yes | Feed config |
item | object | Yes | {title, link, description, pubDate, ...} |
removeItem
Remove item by guid
Module: feed | Returns: object -- Updated config
feed.removeItem $config "https://example.com/old-post"
| Parameter | Type | Required | Description |
|---|---|---|---|
config | object | Yes | Feed config |
guid | string | Yes | Item GUID or link |
sortItems
Sort items by date
Module: feed | Returns: array -- Sorted items
feed.sortItems $items
| Parameter | Type | Required | Description |
|---|---|---|---|
items | array | Yes | Feed items |
descending | boolean | No | Newest first (default true) |
filterItems
Filter items by field regex
Module: feed | Returns: array -- Matching items
feed.filterItems $items "title" "javascript"
| Parameter | Type | Required | Description |
|---|---|---|---|
items | array | Yes | Feed items |
field | string | Yes | Field name |
pattern | string | Yes | Regex pattern |
mergeFeeds
Merge multiple feeds
Module: feed | Returns: object -- Merged feed config
feed.mergeFeeds [$feed1, $feed2]
| Parameter | Type | Required | Description |
|---|---|---|---|
feeds | array | Yes | Array of feed configs |
fetch
Fetch and parse feed from URL
Module: feed | Returns: object -- {ok, status, feed}
feed.fetch "https://example.com/feed.xml"
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Feed URL |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
| (standard errors) | Check function parameters and authentication |
@desc "Create rss and validate result"
do
set $result as feed.createRss {"title": "My Blog", "link": "https://example.com", "items": [...]}
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. Create a new item with createRss
Create a new resource and capture the result.
set $result as feed.createRss {"title": "My Blog", "link": "https://example.com", "items": [...]}
print "Created: " + $result
2. Multi-step Feed workflow
Chain multiple feed operations together.
@desc "Create rss, create atom, and more"
do
set $r_createRss as feed.createRss {"title": "My Blog", "link": "https://example.com", "items": [...]}
set $r_createAtom as feed.createAtom {"title": "My Blog", "link": "https://example.com", "items": [...]}
set $r_createJson as feed.createJson {"title": "My Blog", "items": [...]}
print "All operations complete"
enddo
3. Safe createRss with validation
Check results before proceeding.
@desc "Create rss and validate result"
do
set $result as feed.createRss {"title": "My Blog", "link": "https://example.com", "items": [...]}
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
ftp
JS@robinpathv0.1.3
FTP and SFTP file transfer operations
http
JS@robinpathv0.1.3
HTTP server for RobinPath scripts. Register routes with static responses (JSON, HTML, files), enable CORS, serve static directories. No callbacks needed.
form
JS@robinpathv0.2.1
Declarative form builder for RobinPath scripts � define fields inline, generate schemas, validate submissions
api
JS@robinpathv0.1.2
HTTP client for making requests to external APIs with profiles, auth, download/upload, and auto-JSON parsing
$ robinpath add @robinpath/feed
