mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-10 19:40:48 +01:00
ShrinkUrl: remove 'expand' as longurl.org has been dead for some time
Closes #1243.
This commit is contained in:
parent
ebb48a4808
commit
f4cae9614f
@ -256,33 +256,6 @@ class ShrinkUrl(callbacks.PluginRegexp):
|
|||||||
irc.error(str(e))
|
irc.error(str(e))
|
||||||
x0 = thread(wrap(x0, ['httpUrl']))
|
x0 = thread(wrap(x0, ['httpUrl']))
|
||||||
|
|
||||||
@retry
|
|
||||||
def _getExpandUrl(self, url):
|
|
||||||
url = utils.web.urlquote(url)
|
|
||||||
try:
|
|
||||||
return self.db.get('Expand', url)
|
|
||||||
except KeyError:
|
|
||||||
text = utils.web.getUrl('http://api.longurl.org/v2/expand?url=' + url)
|
|
||||||
text = text.decode()
|
|
||||||
text = text.split('<![CDATA[', 1)[1].split(']]>', 1)[0]
|
|
||||||
self.db.set('Expand', url, text)
|
|
||||||
return text
|
|
||||||
|
|
||||||
@internationalizeDocstring
|
|
||||||
def expand(self, irc, msg, args, url):
|
|
||||||
"""<url>
|
|
||||||
|
|
||||||
Returns an expanded version of <url>.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
expandurl = self._getExpandUrl(url)
|
|
||||||
m = irc.reply(expandurl)
|
|
||||||
if m is not None:
|
|
||||||
m.tag('shrunken')
|
|
||||||
except ShrinkError as e:
|
|
||||||
irc.error(str(e))
|
|
||||||
expand = thread(wrap(expand, ['httpUrl']))
|
|
||||||
|
|
||||||
Class = ShrinkUrl
|
Class = ShrinkUrl
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
@ -113,11 +113,4 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
|
|||||||
shrink.minimumLength.setValue(origLen)
|
shrink.minimumLength.setValue(origLen)
|
||||||
shrink.nonSnarfingRegexp.setValue(origRegexp)
|
shrink.nonSnarfingRegexp.setValue(origRegexp)
|
||||||
|
|
||||||
def testExpand(self):
|
|
||||||
self.assertResponse('expand http://x0.no/0l2k', self.udUrl)
|
|
||||||
self.assertResponse('expand http://x0.no/0l2k', self.udUrl)
|
|
||||||
self.assertResponse('expand http://x0.no/a53s', self.sfUrl)
|
|
||||||
self.assertResponse('expand http://x0.no/a53s', self.sfUrl)
|
|
||||||
self.assertResponse('expand http://x0.no/0l2k', self.udUrl)
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user