quoute search implemented

master
Stefan Krulj 14 years ago
parent 2aef32b0fa
commit b8b12ee6c4
  1. 4
      modules/active/get_quote.py

@ -88,7 +88,7 @@ def quote(msg,args):
con = urllib2.urlopen( req ) con = urllib2.urlopen( req )
data=con.read() data=con.read()
print "data:", args[1][0:2], args[2],url print "data:", args[1][0:2], args[2],"->",search_results[0],url
wqp=WikiQuoteParser() wqp=WikiQuoteParser()
wqp.feed(data) wqp.feed(data)
#for i in wqp.quotes: #for i in wqp.quotes:
@ -98,7 +98,7 @@ def quote(msg,args):
brathuhn.sendMsg(brathuhn.ROOM,'Quoting "'+ search_results[0] +'"') brathuhn.sendMsg(brathuhn.ROOM,'Quoting "'+ search_results[0] +'"')
brathuhn.sendMsg(brathuhn.ROOM,wqp.quotes[randint(0,len(wqp.quotes)-1)],'groupchat') brathuhn.sendMsg(brathuhn.ROOM,wqp.quotes[randint(0,len(wqp.quotes)-1)],'groupchat')
else: else:
brathuhn.sendMsg(brathuhn.ROOM,'Could not crawl quotes from "'+url+'"','groupchat') brathuhn.sendMsg(brathuhn.ROOM,'Could not crawl quotes from > '+url+' <','groupchat')
con.close() con.close()
except exceptions.Exception as e: except exceptions.Exception as e:
brathuhn.sendMsg(brathuhn.ROOM,"Network Error "+unicode(e),'groupchat') brathuhn.sendMsg(brathuhn.ROOM,"Network Error "+unicode(e),'groupchat')

Loading…
Cancel
Save