def parse_feed(self, data, url): url = url.split("?")[0] #print 'url is: ', url once = 0 link = {} doc = libxml2dom.parseString(data, html=1) items = doc.getElementsByTagName('item') top = items[0] bottom = items[len(items)-1] title_top = top.getElementsByTagName('title')[0].childNodes[0].value title_bottom = bottom.getElementsByTagName('title')[0].childNodes[0].value if title_top > title_bottom: item = top elif title_bottom > title_top: item = bottom title = item.getElementsByTagName('title')[0].childNodes[0].value guid = item.getElementsByTagName('guid')[0].childNodes[0].value latesturl = MakeMeTiny(url +'%s' % guid) # print 'result feed me: %s' % latesturl d = defer.Deferred() if not latesturl is None: result = latesturl else: result = 'Fail' reactor.callLater(1,d.callback,result) return d