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:
nyuszika7h 2015-01-24 19:33:33 +01:00 committed by James McCoy
parent 6a134eb302
commit 8266870d9f
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
3 changed files with 3 additions and 35 deletions

View File

@ -40,11 +40,11 @@ def configure(advanced):
conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True)
class ShrinkService(registry.OnlySomeStrings):
"""Valid values include 'ln', 'tiny', 'xrl', 'goo', 'ur1', and 'x0'."""
validStrings = ('ln', 'tiny', 'xrl', 'goo', 'ur1', 'x0')
"""Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'."""
validStrings = ('ln', 'tiny', 'goo', 'ur1', 'x0')
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
def __init__(self, *args, **kwargs):

View File

@ -201,33 +201,6 @@ class ShrinkUrl(callbacks.PluginRegexp):
irc.errorPossibleBug(str(e))
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'
def _getGooUrl(self, url):
url = utils.web.urlquote(url)

View File

@ -41,8 +41,6 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
(udUrl, r'http://tinyurl.com/u479')],
'ln': [(sfUrl, r'http://ln-s.net/4LVF'),
(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'),
(udUrl, r'http://goo.gl/ocTga')],
'ur1': [(sfUrl, r'http://ur1.ca/9xl25'),
@ -98,9 +96,6 @@ class ShrinkUrlTestCase(ChannelPluginTestCase):
def testLnsnarf(self):
self._snarf('ln')
def testXrlsnarf(self):
self._snarf('xrl')
def testGoosnarf(self):
self._snarf('goo')