auths
objectEnter the URL for the RSS feed.
Enter the field name that contains the unique ID for each RSS item. The field name can vary for each feed. Common field names include id
and guid
.
return
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params) => {
}
const Parser = require('rss-parser')
const parser = new Parser()
const feed = await parser.parseURL(params.rss_url)
// assumes only care about remembering last fetch instead of all previous
const checkpoint = this.$checkpoint || {}
const nextCheckpoint = {}
this.newItems = []
for (const item of feed.items || []) {
const id = item[params.id_field_name]
nextCheckpoint[id] = true
if (!checkpoint[id]) this.newItems.push(item)
}
// checkpoint the items so we don't export them on the next workflow execution
this.$checkpoint = nextCheckpoint
// end the workflow execution if no new items were detected
if (!this.newItems.length) $end('No new items found')
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
// we're just console logging the title here
// you can write any node code to handle the feed
steps.rss.newItems.forEach(function(item) {
console.log(item.title);
})