< You're So Vague
Who Wants to Be A Hundredaire? >

Del Eat: I wrote a tiny script that runs my del.icio.us tags through the Eater of Meaning's WordEndingEater to get different words, and prints links to the tag pages for those words. Sometimes these tags don't go anywhere, like "carpets" or "antedates", but sometimes they're pretty interesting, like "macro" (wonderfully ambiguous) and "twenty". It's fun--until you try it yourself!

No packaging; I'll just put it inline for those interested. You need the Eater, of course, and Beautiful Soup (or one of those fancy del.icio.us-Python interfaces with all the XML dependencies).


#!/usr/bin/python
#Del Eat
#by Leonard

import urllib2
import os
import sys
from BeautifulSoup import BeautifulSoup
from eater import WordEndingEater

if len(sys.argv) != 4:
    print 'Usage: %s [username] [password] [path to Eater prefix file]' \
          % sys.argv[0]
    sys.exit(1)

username, password, path = sys.argv[1:]
if not os.path.exists(path):
    print 'No such Eater prefix file: %s' % path
    sys.exit(1)

authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password('del.icio.us API', 'http://del.icio.us', 
                      username, password)
opener = urllib2.build_opener(authinfo)
xml = BeautifulSoup(opener.open('http://del.icio.us/api/tags/get').read())

eater = WordEndingEater(path)
print '<ul>'
for tag in xml('tag'):
    eaten = eater.eatWord(tag['tag'], 'text')
    print '<li><a href="http://del.icio.us/tag/%s/">%s</a></li>' % (eaten,
                                                                    eaten)
print '</ul>'
Filed under:


[Main]

Unless otherwise noted, all content licensed by Leonard Richardson
under a Creative Commons License.