1

Does anybody know where to get list of working long2short service websites? The bigger the better - I need at least 100 of them.

1
  • Why do you need more than one? Jan 20, 2011 at 1:08

3 Answers 3

2

Not all URL shortener services are reliable. Check this comparison of popular URL shortener services for their pros & cons. (Here's a shorter comparison by notlong.)

Google also has their own Goo.gl shortener service with an API. Pingdom found Goo.gl to be the fastest.

2

The list at http://hjacob.com/blog/2009/07/url-shortener-redirects/ looks pretty good. There are still a lot of dead links. Here are the listed URLs that responded 200 OK (which doesn't necessarily mean it is still working as a url shortening service):

For some reason, my favorite wasn't listed.

Here's the code:

#!/usr/bin/env python

import socket
import sys
import urlparse
import urllib

from BeautifulSoup import BeautifulSoup

filename = 'url_shortner_redirects.html'
source = 'http://hjacob.com/blog/2009/07/url-shortener-redirects/'
page = urllib.urlopen(source).read()
soup = BeautifulSoup(page)
links = soup.findAll('a')

good_links = []
# Some links hang forever - set a timeout of 5 seconds
socket.setdefaulttimeout(5)
for link in links:
  # Look for the links with rel=external
  if link.get('rel', '') == 'external' and link.get('title','') != '':
    # Only the links with no path are url shortners - the rest are articles
    url = urlparse.urlparse(link['href'])
    if len(url.path) < 2:
      name = link.string.strip()
      href = link['href']
      try:
        x = urllib.urlopen(href)
        if x.code in [200]:
          print >> sys.stderr, '%s is responding' % href
          good_links.append((name, href))
        elif x.code in [403, 404, 503]:
          print >> sys.stderr, '%s is dead (%d)' % (href, x.code)
        else:
          print >> sys.stderr, "Unknown code %d in %s" % (x.code, href)
          x.close()
      except IOError:
        print >> sys.stderr, "Connection refused for %s" % href

# Print in stack exchange markdown
unique_links = sorted(list(set(good_links)))
print '\n'.join(['* %s - <%s>' % (name, href) for name, href in unique_links])

I hope that helps.

1

A quick Google search found this. Took about 10 seconds to find.

2
  • most of them is not working - it's 2 yo list
    – webisdead
    Jan 18, 2011 at 17:23
  • 1
    Did you Google this? There are plenty of lists out there.
    – John Conde
    Jan 18, 2011 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.