diff --git a/Wikifetch/config.py b/Wikifetch/config.py index 7d23857..1fb67d5 100644 --- a/Wikifetch/config.py +++ b/Wikifetch/config.py @@ -55,8 +55,5 @@ Wikifetch = conf.registerPlugin('Wikifetch') conf.registerChannelValue(Wikifetch, 'url', registry.String(_('en.wikipedia.org'), _("""Default URL of the website to pull from."""))) -conf.registerChannelValue(Wikifetch, 'showRedirects', - registry.Boolean(True, _("""Determines whether redirect paths will - be shown in the output."""))) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Wikifetch/plugin.py b/Wikifetch/plugin.py index 2897b14..477fa71 100644 --- a/Wikifetch/plugin.py +++ b/Wikifetch/plugin.py @@ -143,19 +143,7 @@ class Wikifetch(callbacks.Plugin): self.log.debug('Wikifetch: following search result:') tree, article, addr = self._get_article_tree(None, searchresults[0].get('href')) search = redirect - # otherwise, simply return the title and whether it redirected - elif self.registryValue('showRedirects', msg.args[0]): - redirect = re.search(r'\(%s ]*>([^<]*)\)' % - _('Redirected from'), article) - if redirect: - try: - redirect = tree.xpath('//span[@class="mw-redirectedfrom"]/a')[0] - redirect = redirect.text_content().strip() - title = tree.xpath('//*[@class="firstHeading"]') - title = title[0].text_content().strip() - reply += '"%s" (Redirected from "%s"): ' % (title, redirect) - except IndexError: - pass + # extract the address we got it from - most sites have the perm link # inside the page itself try: diff --git a/Wikifetch/test.py b/Wikifetch/test.py index 3d05ebd..c245dbf 100644 --- a/Wikifetch/test.py +++ b/Wikifetch/test.py @@ -66,9 +66,8 @@ if network: self.assertNotError('wiki GNU/Linux') self.assertNotError('wiki --site en.wikipedia.org /') - def testRedirects(self): - self.assertRegexp('wiki Foo', '"Foobar" \(Redirected from "Foo"\): ' - 'The terms \x02foobar\x02') + def testFollowRedirects(self): + self.assertRegexp('wiki YVR', 'Vancouver International Airport') def testWikiBold(self): self.assertRegexp('wiki Apple', '\x02')