Show del.icio.us bookmarks on your blog

 del.icio.us is a social bookmarking site.

Using this template along with  Pydelicious you can show your latest bookmarks on your blog/website.

<%args>
username="btbytes"
count=5
</%args>

Specify your username and the number of bookmarks you want listed.

<%flags>
  use_cache = True
  cache_type = 'dbm'
  cache_expiretime = 36000
</%flags>

Use caching to retrieve the links once in 10 hours (3600 * 10).

<%init>
import pydelicious
rss = pydelicious.getrss(user=username)

# encode strings in utf-8 format
posts = []
for post in rss:
    tmp = {}
    for k in post.keys():
        tmp.update({k: post[k].encode('utf-8')})
    posts.append(tmp)

</%init>
  • Imports the pydelicious library.
  • Fetches the bookmarks as RSS.
  • Converts all strings to utf-8. (not sure whether this is the best way)
%for post in posts[:count]:
    <li><a href="<% post['href'] %>"><% post['description'] %></a> </li>
%   tags = post['tags'].split(' ')
%   s = ''
<small>
%   for tag in tags:
        <a href="http://del.icio.us/<%username%>/<%tag%>/"><%tag%></a>,
%
</small>

Prints the bookmarked link and related tags. You can customise the output using other HTML tags as per your liking.

Download the file below.

Attachments



Powered by Pylons - Contact Administrators