add JSON output plugin

This plugin is very simple, if not trivial: it simply dumps all the
feed items in a JSON stream. This can be parsed by `jq` on the
commandline to diagnose feed problems, do scripting or whatever.

This is different from how plugins normally receive "arguments", which
are "shell-quoted". For example, the `exec` plugin, when called with
`{item.url} {item.title}` would receive it as a shell-quoted ("$URL"
"$TITLE") string, and not JSON.
parent 55fa498e
Pipeline #48422044 passed with stage
in 2 minutes and 33 seconds
import json
class output(object):
"""
This plugin outputs, to standard output, the feed item it receives as JSON.
It can be used to pipe a feed into another program or just basic inspection.
This plugin can also be called as a filter, where it behaves the same way.
"""
called = None
def __init__(self, *args, feed=None, item=None, **kwargs):
print(json.dumps(item))
#: This filter just keeps the feed unmodified. It is just there for testing
#: purposes.
filter = output
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment