def DuckDuckGo(cmd):
debug(cmd.text)
q = cmd.text.split()
if len(q) == 1:
return
question = "+".join(q[1:])
debug("Question=%s" % question)
req = requests.get("https://duckduckgo.com/html/?q=%s" % question)
answer = None
html = bp.BeautifulSoup(req.text)
responses = html.findAll("div", id="zero_click_abstract")
try:
answer = responses[0].text
except Exception as e:
print e # get internal
pass
if not answer:
bot.reply_to(cmd, "Não tenho a menor idéia. Tem de perguntar no google.")
return
try:
bot.reply_to(cmd, answer)
except Exception as e:
bot.reply_to(cmd, "Deu merda: %s" % e)
评论列表
文章目录