Manjaro forum - RSS feeds via Python

Manjaro forum RSS feeds

The Manjaro forum - being based on Discourse - has RSS feeds for almost everything even the topics.

Just add .rss to the url shown in the address bar.

Announcements

You can use a feedreader to subscribe but what if you do just want the occational check without opening a feedreader or a browser?

Python

A few lines of python can display a number of topics from e.g. the #announcements thread or you could dive deeper #announcements:unstable-updates

Install the python package python-feedparser

sudo pacman -Syu python-feedparser

Use your favorite text editor to create a file and paste below content.

#!/usr/bin/python3
import feedparser

f = feedparser.parse("https://forum.manjaro.org/c/announcements.rss")
for i in range(5):
    print(f.entries[i].title)

Save the file in your home folder ~/manjaro-rssfeed.py.

Run the script with python.

python manjaro-rssfeed.py

Customizing the output

If one only wants the announcements for a single branch you modify the script slightly - for the stable branch you change the url

f = feedparser.parse("https://forum.manjaro.org/c/announcements/stable-updates.rss")

If one wants fewer or more entries change the range() to match your preference

for i in range(5):

Running from anywhere

To run the script from anywhere, make it executable and move it to your local bin folder

chmod +x ~/manjaro-rssfeed.py
mkdir -p ~/.local/bin
mv ~/manjaro-rssfeed.py ~/.local/bin    

Doing so makes it possible to include it in a conky.

Conky

Sample conky

The examples runs the script every 300s (5min)

conky.config = {
    alignment = 'top_left',
	background = true,
	color2 = '8B8673',
	cpu_avg_samples = 2,
	default_color = '8B8673',
	double_buffer = true,
	font = 'DejaVu Sans Mono Boot:size=10',
	draw_shades = false,
	gap_x = 25,
	gap_y = 45,
	minimum_width = 250,
	no_buffers = true,
	own_window = true,
	own_window_class = "Conky",
	own_window_type = 'desktop',
	own_window_transparent = true,
	update_interval = 2.0,
	use_xft = true,
}
-- [[run conky every 300 seconds]]
conky.text = [[
${hr}
Manjaro - announce
${execi 300 manjaro-rssfeed.py}
]];

Some conky versions have built-in support for rssfeeds in which case you can add below line to the conky.text property where the parts are

  • url
  • reload time in minutes
  • item_titles - is the number of items to show
${rss https://forum.manjaro.org/c/announcements.rss 1 item_titles 4}
14 Likes

Forum kindly sponsored by Bytemark