how to AUTOMATICALLY save all articles to files, and quit?

148 views
Skip to first unread message

Marco Fioretti

unread,
Jan 19, 2023, 12:37:43 AM1/19/23
to news...@googlegroups.com
Greetings,

I just started using newsboat and it's great, but there must be something basic that I don't understand, or recognize, in the documentation. I would like to run newsboat from a bash script, so that it:

1. downloads ONE feed
2. downloads all the articles in that feed
3. saves each of those articles in a separate, plain text file that I can parse later
4. quits

Is this possible? If yes, how? As I said, I have already read the documentation and tried several combinations of options, but they are either invalid, or not doing what I need, so I must miss something (again, assuming what I want to do is possible to begin with, which I am not sure of)

thanks,
Marcoo

dennis...@gmail.com

unread,
Jan 19, 2023, 7:21:00 AM1/19/23
to newsboat
Hi Marcoo,

I don't think that is possible at the moment, and that kind of automation is not really something we are likely to support/implement in Newsboat.
Newsboat does have a save-all operation, but that is only available as an interactive option via the builtin cmdline (`:exec save-all` in the list of articles: https://newsboat.org/releases/2.30.1/docs/newsboat.html#save-all)

Based on the description, maybe sfeed would be a better fit: https://codemadness.org/sfeed-simple-feed-parser.html
From the sfeed description:
> It converts RSS or Atom feeds from XML to a TAB-separated file.
and
> There are also some programs and scripts included to <...> fetch, filter, merge and order feed items.
However, I didn't use it before, so I'm not sure how to use it.

If you really want to use Newsboat for this, the first two steps of your list can be automated with newsboat and some other CLI tools, e.g.:
```
#!/usr/bin/env bash

set -e
set -x

RSS_URL='https://newsboat.org/news.atom'
TEMP=`mktemp -d`

echo "$RSS_URL" >> "$TEMP/urls"
newsboat --url-file "$TEMP/urls" --cache-file "$TEMP/cache.db" --config-file /dev/null --execute reload
# Show number of articles in database
sqlite3 "$TEMP/cache.db" 'select COUNT(*) from rss_item;'
```

Afterwards, the cache file (an sqlite3 database) can be queried with the sqlite3 CLI tool.
However, that is again a tool I'm not very familiar with.
Keep in mind that the database model is an implementation detail, we don't guarantee that the database schema will be kept backwards compatible.

Kind regards,
Dennis
Reply all
Reply to author
Forward
0 new messages