An ugly but simple V2EX RSS client

It’s been a while since I wrote my last article here. During the winter break I went to three national parks in California, Utah and Arizona, the experience of which is astonishing. Obviously, I have put all of my focus into photography and adventure…….

Alright, after I came home, I as usual would check some forums to see if there’s any update about technology and data science. Among those websites, V2EX is one of my favourite because it is an active, user-friendly website that has a lot of interesting piece of news. I know there are already some people who have developed fascinating third party apps in OS X, but I am more than happy to find out the way to do it.

I have known RSS for a long time, which means, I knew it before Google reader closed…… I seldom used it right now, because I indeed don’t need to overload my information flow with RSS and not too many websites are worth checking every day. To make a RSS reader for my needs, I just need two things, one is a simple interface without ads and distractions, the other one is a simple representation of article titles that are clickable. What about the author and description? Not important to me at all. I make it because I need it to be in this way instead of anything else.

Screen Shot 2016-01-28 at 10.19.13 AM

Okay, import RSS, run…. No way… It is Python but it is not that easy to make it. I did research on the Internet and confirmed the primary packages that I need to use: feedparser(an elegant package to read RSS or xml webpage), and tkinter(to create simple user interface).

Frankly speaking, I am really pissed off by the tkinter packages, because it is so non-Pythonly that it contains a lot of confusing concepts that I am not familiar with. I read a book about tkinter before and it is like, it is a PROGRAMMING LANGUAGE itself! I had a terrible time dealing with it every time I used it. Instead, feedparser is incredibly easy to use. It automatically renders the author, published time, description and so on of the newest articles from the webpage. To split the time I spent on this project, I would say 65% of it is attributed to damn tkinter.

Another difficult point in this program is the time zone issue. By default, the published time is UTC format. I tried to use “time.localtime()” to transform it but it fails. YEAH, IT FAILS! It is executed successfully but its format is still in UTC instead of the local time zone PST. Neither did “time.strftime()” work. After debugging, I am pretty sure that it is due to the timestamp I make could not be transform correctly. Later I found a post using calendar package to transform the formatted UTC format in to a correct localized timestamp. Thanks to the StackOverFlow!

This program is designed specifically for V2EX program, but I have tried to use it on other websites since I made an input box….It kind of works, but it needs to be adjusted in some ways.

Firstly, since I am labelling without any format, sometimes a long title would exceed the window limit, therefore it requires users to adjust the canvas size in line 30.

Screen Shot 2016-01-28 at 9.58.27 AM

Secondly, since it provides the published time, it seems to me that every website would use different time format, for example, when scraping Verge, it would encounter this error, requiring user to match the format in line 107.

Screen Shot 2016-01-28 at 10.30.04 AM

Thirdly, some attributes are not available in some websites. For example, when I input Reddit front page, it says that description is not available in line 104, so I have commented those lines in order to enhance it versatility.

Alright, from today on, I will never open the browser and input address and endure the interface and potential ads. All I have is traditionally-tasted titles and links, and I know I am gonna use it. 🙂

2 Comments

  1. Major thankies for the blog post.Really looking forward to read more. Fantastic.

  2. JoshuaFGamel says:

    I’d love to be grateful for the efforts you’ve place in penning this website.
    I’m hoping to check out the same high-grade content on your part later on too.

    Actually, your creative writing abilities has encouraged
    me to acquire my, personal website now 😉

Leave a Reply

Your email address will not be published. Required fields are marked *