feedparserについて

http://d.hatena.ne.jp/g7umz1cuwvsy/20070502/1178110615
触発されて作ってみました。(Windows専用)
配列placetogoに格納したRSSフィードを集めて、/デスクトップ/新着(time).txtにタイトルとURLのコレクションを作ります。

# coding: utf-8
import feedparser
import string
import win32com.client
import os
from time import *

wsh = win32com.client.Dispatch("WScript.Shell")
desktop =wsh.SpecialFolders("Desktop")
placetogo =['http://hoge','http://mage']
def main():
	f =  open(os.path.join(desktop)+u'?新着' + str(int(time())) + ".txt","w")
	for x in placetogo:
		data=feedparser.parse(x)
		for i in range(0,len(data.entries)):
			href  =  gethref(data['entries'][i])
			title = gettitle(data['entries'][i])
			contents = format_diary(href,title)
			f.write(contents)
def gethref(feed):
	return feed['links'][0]['href']
def gettitle(feed):
	return feed['title']
def format_hatena(href,title):
	return "[%s:title=%s]?n" % (href ,title)
def format_diary(href,title):
	return ":%s:%s?n" % (title,href)

if __name__=="__main__":
    main()