#!/usr/bin/env python import urllib import sys def fetchRSS( rss ): """Download's the feed and returns the temp name""" tempfilename = '/tmp/.rss-hack' tempfile = open("%s-2" % tempfilename,'w+') # better later on conn = urllib.urlopen( rss ) while 1: s = conn.read(2) if not s: break tempfile.write( s ) conn.close() tempfile.close() # fix for some problems with for exampel the rss from the register (my fault) tempfile = open("%s-2" % tempfilename) tempdata = tempfile.readlines() tempfile.close() tempfile = open(tempfilename, 'w+') for row in tempdata: row = row.replace('','\n').replace('','\n').replace('','\n') tempfile.write( row ) tempfile.close() return tempfilename def praseRSS( rssfile ): """Prase an rss file (or extract the title and link, description and return them as a list)""" tempfile = open(rssfile,'r') templist = tempfile.readlines() tempfile.close() titles = list() links = list() description = list() def cutterMan(string, startTag, endTag, grepStart, grepEnd, offset = 0): """Cut's away nastiness and cleans my code""" start = string.find( startTag ) stop = string.find( endTag ) string = string.strip()[start:stop] start = string.find( grepStart ) + offset stop = string.find( grepEnd ) string = string.strip()[start:stop] return string for temp in templist: if temp.find('