Attachment 'Delicious.py'
Download 1 """
2 Delicious bookmark viewer
3
4 Copyright (C) 2007 Boris Smus <boris@z3.ca>
5 Licence: GPL [see http://www.gnu.org/copyleft/gpl.html]
6 """
7
8 import simplejson, urllib2
9
10 USER_NAME = 'miraage'
11 POST_COUNT = 7
12 JSON_URL = 'http://del.icio.us/feeds/json/%s/?raw;count=%d' % (USER_NAME, POST_COUNT)
13 TAG_URL = 'http://del.icio.us/%s/' % USER_NAME + '%s'
14
15 Dependencies = []
16
17 def execute(macro, args):
18 posts = simplejson.load(urllib2.urlopen(JSON_URL))
19
20 html = []
21 html.append(macro.formatter.number_list(1))
22 for post in posts:
23 html.append(macro.formatter.listitem(1))
24 html.append(macro.formatter.url(1, post['u']))
25 html.append(post['d'])
26 html.append(macro.formatter.url(0))
27 html.append(macro.formatter.text(" / "))
28 for tag in post['t']:
29 html.append(macro.formatter.url(1, TAG_URL % tag))
30 html.append(tag)
31 html.append(macro.formatter.url(0))
32 html.append(macro.formatter.text(" "))
33 html.append(macro.formatter.listitem(0))
34
35 html.append(macro.formatter.number_list(0))
36
37 return "".join(html)
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.You are not allowed to attach a file to this page.