Conky rss with more info than just title [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
sashkello
Level 1
Level 1
Posts: 11
Joined: Wed Aug 14, 2013 6:57 pm

Conky rss with more info than just title [SOLVED]

Post by sashkello »

Hi all!

I've started playing with Conky recently and wanted to customize the appearance of rss feed. It shows up allright, the only problem is that I can't find how to add some info to it. I.e., what if I want something like this:

[date] title (author)
first few lines of text

Say, latest 5 posts...

Now, the standard rss parser only can do titles and I dan't find any examples of more advanced display.

Did anyone write something similar to it? If not, can someone please link/show samples of how to customize the rss parsing (bash / perl script?), just to get started...
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
sashkello
Level 1
Level 1
Posts: 11
Joined: Wed Aug 14, 2013 6:57 pm

Re: Conky rss with more info than just title

Post by sashkello »

OK, I actually figured it out myself (not completed yet, but have some start). Maybe not the best solution, but here you go.

rss.py

Code: Select all

import feedparser
import datetime as dt

feed = feedparser.parse("http://addressofmyfeed")
for i in range(20):
    print "[" + dt.datetime.strftime(dt.datetime.strptime(feed["items"][i]["published"][:-6].rstrip(), "%a, %d %b %Y %H:%M:%S"), "%d %b %Y") + "]" + " " + feed["items"][i]["title"]
In .conkyrc text area added this:

Code: Select all

${exec python ~/rss.py}
It properly formats Conky output as:

Code: Select all

[13 Aug 2013] New thing happened!
[10 Aug 2013] Some blog post title here
[07 Aug 2013] This is what I think
etc...
Habitual

Re: Conky rss with more info than just title

Post by Habitual »

sashkello wrote:OK, I actually figured it out myself (not completed yet, but have some start). Maybe not the best solution, but here you go.
Great Job crafting a solution!

It doesn't have to be the "best" as that is subjective.
Locked

Return to “Compiz, Conky, Docks & Widgets”