I lurk in an IRC chatroom with some friends and throughout the course of a day a lot of links are posted.
I wanted to be able to catch up on the links without having to read through the entire channel backlog, so I hacked together a new module for Phenny (a Python IRC bot) which posted the links to a Delicious account. I subscribe to that account via Google Reader, and read through the latest Internet memes at my leisure.
To use my little hack:
- Install pydelicious
- Install Phenny
- copy the following code into a new file:
modules/delicious.py#!/usr/bin/env python """ delicious.py - Automatically post URLs to delicious Author: Michael Schurter, http://michael.susens-schurter.com/ License: Public Domain About: http://inamidst.com/phenny/ """ import re import pydelicious r = re.compile(r'http\S*') def f_delicious(self, origin, match, args): try: matches = r.findall(match.group()) if matches: d = pydelicious.DeliciousAPI('DELICIOUS_USERNAME', 'DELICIOUS_PASSWORD') for url in matches: title = '%s: %s' % (origin.nick, match.group()) if len(title) > 50: title = '%s...' % title[:50] d.posts_add( url=url, description=title, extended=match.group(), # Add custom tags below tags='oggbot oggbot-added-by:%s' % origin.nick ) except: self.msg(origin.sender, 'Oops! Missed that one. Blame schmichael!') f_delicious.rule = r'.*'
- Fill in delicious account information in the obvious place.
- Start/Restart Phenny and watch posted links appear in delicious.
There’s lots of room for improvement in the code, but it works for me!
Sorry for poor tab spacing. I had vim configured for some Drupal hacking and forgot to switch back to 4-space tabs.