diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/atom.js | 22 | ||||
-rwxr-xr-x | scripts/atom.sh | 19 |
2 files changed, 41 insertions, 0 deletions
diff --git a/scripts/atom.js b/scripts/atom.js new file mode 100644 index 0000000..878df05 --- /dev/null +++ b/scripts/atom.js @@ -0,0 +1,22 @@ +const RSS = require('rss'); + +const feedName = process.argv[2]; +const feedSrc = process.argv[3]; + +const feed = new RSS({ + title: `Buku feed tag for '${feedName}'.`, + description: `Buku feed tag for ${feedName}`, +}); + +const items = require(feedSrc); +items.forEach(({ title, description, uri }) => { + feed.item({ + title, + description, + url: uri + }); +}); + +const xml = feed.xml({indent: true}); + +console.log(xml); diff --git a/scripts/atom.sh b/scripts/atom.sh new file mode 100755 index 0000000..73c35ec --- /dev/null +++ b/scripts/atom.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +if [[ ! -d "node_modules" ]]; then + npm i rss +fi + +feed() { + local tag="$1" + local tmp="/tmp/$tag.json" + buku -t "$tag" --json > "$tmp" + node atom.js "$tag" "$tmp" +} + +mkdir -p ~/.newsboat +feed ril > ~/.newsboat/ril.xml +feed simple-archive > ~/.newsboat/simple-archive.xml +feed inbox > ~/.newsboat/inbox.xml |