Attachment 'GoogleNews.py'
Download
1
2
3
4
5
6 Dependencies = ["time"]
7
8 from MoinMoin import util, wikiutil, config
9 from MoinMoin.Page import Page
10
11 class RSStoWiki:
12 def __init__(self, macro):
13 self.macro = macro
14 self.fmt = macro.formatter
15
16 url = "http://blogsearch.google.com/blogsearch_feeds?hl=en&client=news&scoring=d&q=%22personal+telco%22&ie=utf-8&num=10&output=rss"
17 import feedparser
18 self.f = feedparser.parse(url)
19 self.result = []
20
21 def get_link(self, link):
22 self.result.append(self.fmt.url(on=1, href=link) + \
23 self.fmt.icon('www'))
24
25 def get_entry_header(self, title):
26 self.result.append(self.fmt.rawHTML(" "+title) + \
27 self.fmt.url(on=0) + \
28 self.fmt.rawHTML('<br>'))
29
30 def get_entries(self):
31 for entry in self.f.entries:
32 if entry.has_key('link'):
33 self.get_link(entry.link)
34 if entry.has_key('title'):
35 self.get_entry_header(entry.title)
36
37 def get_output(self):
38 self.get_entries()
39 return ''.join(self.result)
40
41 def execute(macro, args):
42 rss = RSStoWiki(macro)
43 return rss.get_output()
44
New Attachment
Attached Files
To refer to attachments on a page, use
attachment:filename, as shown below in the list of files. Do
NOT use the URL of the
[get] link, since this is subject to change and can break easily.
- [get | view] (2008-04-29 11:55:04, 1.3 KB) [[attachment:GoogleNews.py]]