Skip to content

Commit e04588a

Browse files
committed
Implemented burnurl.com service.
1 parent 30dbbf6 commit e04588a

File tree

4 files changed

+55
-7
lines changed

4 files changed

+55
-7
lines changed

README

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Requirements:
1616
Simplejson (not required in python 2.6+)
1717

1818
Supported URL shortening services for shrinking long urls:
19-
sandbox (stored locally in memory for testing)
20-
tinyurl.com
21-
tr.im
22-
urlborg.com
19+
20+
tinyurl.com burnurl.com
21+
tr.im hurl.ws
22+
urlborg.com xr.com
2323
bit.ly
2424
is.gd
2525
cli.gs
@@ -35,12 +35,14 @@ Supported URL shortening services for shrinking long urls:
3535
to.ly
3636
budurl.com
3737
kl.am
38-
xr.com
39-
hurl.ws
4038

4139
Shorty can expand any url service by getting the redirect
4240
location by requesting the tiny url.
4341

42+
Shorty also comes with a service called sandbox. This service stores
43+
the urls in memory and is useful for testing your application
44+
independently from a remote service.
45+
4446
See example.py for a demo of using this library.
4547

4648
Build:

TODO

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
API available and ready to go!
22
++++++++++++++++++++++++++++++
3-
+ burnurl.com
43
+ u.mavrev.com
54
+ snipr.com/snipurl.com/sn.im
65
+ adjix.com

services/burnurl.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Shorty
2+
## Copyright 2009 Joshua Roesslein
3+
## See LICENSE
4+
5+
## @url burnurl.com
6+
class Burnurl(Service):
7+
8+
def _test(self):
9+
# all we can test is shrink
10+
turl = self.shrink('http://test.com')
11+
if turl.startswith('http://burnurl.com'):
12+
return True
13+
else:
14+
return False
15+
16+
def shrink(self, bigurl):
17+
resp = request('http://burnurl.com/', {'url': bigurl, 'output': 'plain'})
18+
return resp.read()
19+
20+
def expand(self, tinyurl):
21+
# burnurl uses iframes for displaying original url
22+
# so we cannot expand them using the 301 redirect :(
23+
return None
24+

shorty.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,28 @@ def expand(self, tinyurl):
347347

348348
fongs = Fongs()
349349

350+
# burnurl
351+
class Burnurl(Service):
352+
353+
def _test(self):
354+
# all we can test is shrink
355+
turl = self.shrink('http://test.com')
356+
if turl.startswith('http://burnurl.com'):
357+
return True
358+
else:
359+
return False
360+
361+
def shrink(self, bigurl):
362+
resp = request('http://burnurl.com/', {'url': bigurl, 'output': 'plain'})
363+
return resp.read()
364+
365+
def expand(self, tinyurl):
366+
# burnurl uses iframes for displaying original url
367+
# so we cannot expand them using the 301 redirect :(
368+
return None
369+
370+
burnurl = Burnurl()
371+
350372
# tweetburner
351373
class Tweetburner(Service):
352374

@@ -736,6 +758,7 @@ def expand(self, tinyurl):
736758
'xr.com': xr,
737759
'short.ie': shortie,
738760
'sandbox.com': sandbox,
761+
'burnurl.com': burnurl,
739762
'a.gd': agd,
740763
'hurl.ws': hurlws,
741764
'digg.com': digg,

0 commit comments

Comments
 (0)