#!/usr/bin/env python # # h3x, an IRC bot written in Python # lastfm.py import string, re from urllib import urlopen def lastfm(user): # open the site last = urlopen("http://ws.audioscrobbler.com/1.0/user/%s/recenttracks.rss" % user) # read and close readit = last.read() last.close() # what we are looking for played = re.compile('(.*?)', re.DOTALL) # tell me last 5 songs info = played.findall(readit)[:6] return info ##kod u h3x.py za pozivanje: # LastFM if ":!lastfm" in raw: lfm = lastfm.lastfm(msg[4]) if lfm != None: send(msg[2], lfm)