updated to differentiate between generic and special feeds
This commit is contained in:
parent
df031eaa4a
commit
acdb9ff8d7
1 changed files with 7 additions and 1 deletions
8
index.js
8
index.js
|
|
@ -78,7 +78,13 @@ export default async function now() {
|
||||||
.replace('{instance}', item.instance || '')
|
.replace('{instance}', item.instance || '')
|
||||||
}
|
}
|
||||||
|
|
||||||
const latest = await handler(feedUrl || { ...item, feedUrl })
|
// generic handlers expect just feedUrl string, special handlers expect config object
|
||||||
|
const handlerParam = ['rss', 'atom', 'json', 'mastodon', 'maloja'].includes(
|
||||||
|
item.feedType,
|
||||||
|
)
|
||||||
|
? feedUrl
|
||||||
|
: { ...item, feedUrl }
|
||||||
|
const latest = await handler(handlerParam)
|
||||||
console.log(`${item.id}: ${latest.text}`)
|
console.log(`${item.id}: ${latest.text}`)
|
||||||
console.log(`${item.id} URL: ${latest.url}`)
|
console.log(`${item.id} URL: ${latest.url}`)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue