From 9a785cfff4f5de6928b97f1f6bdb07b463ee6660 Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Fri, 22 Mar 2019 18:07:50 -0400 Subject: [PATCH] better url handling --- WikiLeaf/plugin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WikiLeaf/plugin.py b/WikiLeaf/plugin.py index d218c9a..158995d 100644 --- a/WikiLeaf/plugin.py +++ b/WikiLeaf/plugin.py @@ -35,19 +35,19 @@ class WikiLeaf(callbacks.Plugin): header = {'User-Agent':str(ua.random)} data = requests.get(searchurl, headers=header) soup = BeautifulSoup(data.text) - url = soup.find('cite').getText() - title = soup.find("h3").getText() + elements = soup.select('.r a') + url = elements[0]['href'] except Exception: return else: - return title, url + return url def strain(self, irc, msg, args, strain): """ Returns strain information from WikiLeaf. Search powered by Google. """ try: - title, url = self.dosearch(strain) + url = self.dosearch(strain) except Exception: irc.reply("No results found, what have you been smoking?") else: