mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
ShrinkUrl: Remove xrl.us
> Please note: Adding new links has been disabled since September 2014 > after 14 months notice. Source: http://metamark.net/ Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
parent
6a134eb302
commit
8266870d9f
@ -40,11 +40,11 @@ def configure(advanced):
|
|||||||
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
|
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
|
||||||
|
|
||||||
class ShrinkService(registry.OnlySomeStrings):
|
class ShrinkService(registry.OnlySomeStrings):
|
||||||
"""Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'."""
|
"""Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."""
|
||||||
validStrings = ('ln', 'tiny', 'xrl', 'goo', 'ur1', 'x0')
|
validStrings = ('ln', 'tiny', 'goo', 'ur1', 'x0')
|
||||||
|
|
||||||
class ShrinkCycle(registry.SpaceSeparatedListOfStrings):
|
class ShrinkCycle(registry.SpaceSeparatedListOfStrings):
|
||||||
"""Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'."""
|
"""Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."""
|
||||||
Value = ShrinkService
|
Value = ShrinkService
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -201,33 +201,6 @@ class ShrinkUrl(callbacks.PluginRegexp):
|
|||||||
irc.errorPossibleBug(str(e))
|
irc.errorPossibleBug(str(e))
|
||||||
tiny = thread(wrap(tiny, ['url']))
|
tiny = thread(wrap(tiny, ['url']))
|
||||||
|
|
||||||
_xrlApi = 'http://metamark.net/api/rest/simple'
|
|
||||||
def _getXrlUrl(self, url):
|
|
||||||
quotedurl = utils.web.urlquote(url)
|
|
||||||
try:
|
|
||||||
return self.db.get('xrl', quotedurl)
|
|
||||||
except KeyError:
|
|
||||||
data = utils.web.urlencode({'long_url': url})
|
|
||||||
text = utils.web.getUrl(self._xrlApi, data=data)
|
|
||||||
if text.startswith('ERROR:'):
|
|
||||||
raise ShrinkError, text[6:]
|
|
||||||
self.db.set('xrl', quotedurl, text)
|
|
||||||
return text
|
|
||||||
|
|
||||||
def xrl(self, irc, msg, args, url):
|
|
||||||
"""<url>
|
|
||||||
|
|
||||||
Returns an xrl.us version of <url>.
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
xrlurl = self._getXrlUrl(url)
|
|
||||||
m = irc.reply(xrlurl)
|
|
||||||
if m is not None:
|
|
||||||
m.tag('shrunken')
|
|
||||||
except ShrinkError, e:
|
|
||||||
irc.error(str(e))
|
|
||||||
xrl = thread(wrap(xrl, ['url']))
|
|
||||||
|
|
||||||
_gooApi = 'https://www.googleapis.com/urlshortener/v1/url'
|
_gooApi = 'https://www.googleapis.com/urlshortener/v1/url'
|
||||||
def _getGooUrl(self, url):
|
def _getGooUrl(self, url):
|
||||||
url = utils.web.urlquote(url)
|
url = utils.web.urlquote(url)
|
||||||
|
@ -41,8 +41,6 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
|
|||||||
(udUrl, r'http://tinyurl.com/u479')],
|
(udUrl, r'http://tinyurl.com/u479')],
|
||||||
'ln': [(sfUrl, r'http://ln-s.net/4LVF'),
|
'ln': [(sfUrl, r'http://ln-s.net/4LVF'),
|
||||||
(udUrl, r'http://ln-s.net/2\$K')],
|
(udUrl, r'http://ln-s.net/2\$K')],
|
||||||
'xrl': [(sfUrl, r'http://xrl.us/bfq8ik'),
|
|
||||||
(udUrl, r'http://xrl.us/bfnyji')],
|
|
||||||
'goo': [(sfUrl, r'http://goo.gl/3c59N'),
|
'goo': [(sfUrl, r'http://goo.gl/3c59N'),
|
||||||
(udUrl, r'http://goo.gl/ocTga')],
|
(udUrl, r'http://goo.gl/ocTga')],
|
||||||
'ur1': [(sfUrl, r'http://ur1.ca/9xl25'),
|
'ur1': [(sfUrl, r'http://ur1.ca/9xl25'),
|
||||||
@ -98,9 +96,6 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
|
|||||||
def testLnsnarf(self):
|
def testLnsnarf(self):
|
||||||
self._snarf('ln')
|
self._snarf('ln')
|
||||||
|
|
||||||
def testXrlsnarf(self):
|
|
||||||
self._snarf('xrl')
|
|
||||||
|
|
||||||
def testGoosnarf(self):
|
def testGoosnarf(self):
|
||||||
self._snarf('goo')
|
self._snarf('goo')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user