用rss2email阅读feeds
source link: http://maskray.me/blog/2011-07-20-read-feeds-with-rss2email
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
用rss2email阅读feeds
很久没用rss的阅读器了,以前曾用过 emacs 的 newsticker ,不支持HTML。也用过Google Reader,打开速度太慢,而且对Pentadactyl不友好。
把feeds转成邮件来阅读
我的想法是找一款工具,把feeds转换成邮件,由本地的procmail处理(归类),然后再用mutt阅读。
rss2email
rss2email就是这样一个能把feeds转成邮件的工具,Python写的,可以通过SMTP把邮件投递给服务器或者把邮件转交给MTA。可惜的是它没法像getmail或是fetchmail那样,指定用于处理邮件的程序。
它的使用还是比较简单的,配置只有两歩:
- r2e new [email protected] ,转换得到的 feeds 默认投递到
[email protected]
- r2e add http://feed.url/somewhere.rss ,订阅一个源
以后只要运行r2e run就能把新的feeds转成邮件发送给你配置时设置的邮箱。我把这条命令写到了=crontab=里。
原来的设想
我最初设想是安装个MTA,比如postfix,r2e把邮件交给MTA,MTA把收到的邮件交给procmail。但这样略显麻烦,MTA的配置挺麻烦的,还得让它开机自动启动。
能否绕过 MTA 呢
我决定修改rss2email的源码来避免 MTA 。rss2email的源码是比较简单的,在/usr/lib/python2.7/site-packages/rss2email/main.py
中搜索sendmail
就找到了这样一行:
不难看出 recipient 就是指定的邮箱。比如 recipient 是 ray@localhost ,它会调用 /usr/sbin/sendmail ray@localhost 来把邮件转交给 sendmail (/MTA/)。
只要把这行改成:
r2e就会直接把邮件交给procmail了。
- 修改
/usr/lib/python2.7/site-packages/rss2email/main.py
- r2e new ray , ray 是我的用户名
- r2e add http://feed.url1/somewhere.rss
- r2e add http://feed.url2/somewhere.rss
- r2e add http://feed.url3/somewhere.rss
- 配置 procmail ,根据邮件头的 User-Agent 和 X-RSS-Feed 信息来决定投递到哪个 maildir/mbox 。
- 把 r2e run 加入 crontab
下面是我添加到 ~/.procmailrc 中的内容:
:0
* ^User-Agent: rss2email
{
:0
* ^X-RSS-Feed: http://news.ycombinator.com/rss
rss/hacker-news/
:0
* ^X-RSS-Feed: http://solidot.org.feedsportal.com/c/33236/f/556826/index.rss
rss/solidot/
:0
* ^X-RSS-Feed: http://feeds.feedburner.com/linuxtoy
rss/linuxtoy/
:0
* ^X-RSS-Feed: http://jandan.net/feed
rss/jandan/
}
2014年11月26日更新
这个方案已废弃,改用newsbeuter阅读rss了。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK