File tree Expand file tree Collapse file tree 4 files changed +72
-1
lines changed Expand file tree Collapse file tree 4 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ Supported URL shortening services for shrinking long urls:
30
30
fon.gs
31
31
fwd4.me
32
32
chilp.it
33
+ short.ie
33
34
34
35
Shorty can expand any url service by getting the redirect
35
36
location by requesting the tiny url.
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ API available and ready to go!
8
8
+ kl.am
9
9
+ adjix.com
10
10
+ metamark.net (xrl.us)
11
- + short.ie
12
11
+ idek.net
13
12
+ xr.com
14
13
+ to.ly
Original file line number Diff line number Diff line change
1
+ ## Shorty
2
+ ## Copyright 2009 Joshua Roesslein
3
+ ## See LICENSE
4
+
5
+ ## @url short.ie
6
+ class Shortie (Service ):
7
+
8
+ def __init__ (self , email = None , secretkey = None ):
9
+ self .email = email
10
+ self .secretkey = secretkey
11
+
12
+ def _test (self ):
13
+ # prompt for email and key
14
+ self .email = raw_input ('shortie email: ' )
15
+ self .secretkey = raw_input ('shortie secretKey: ' )
16
+
17
+ Service ._test (self )
18
+
19
+ def shrink (self , bigurl , tag = None , private = False ):
20
+ if self .email is None or self .secretkey is None :
21
+ raise ShortyError ('Must provide an email and secretkey' )
22
+ parameters = {
23
+ 'email' : self .email , 'secretKey' : self .secretkey ,
24
+ 'format' : 'json' ,
25
+ 'url' : bigurl
26
+ }
27
+ if tag :
28
+ parameters ['custom' ] = tag
29
+ if private :
30
+ parameters ['private' ] = 'true'
31
+ resp = request ('http://short.ie/api' , parameters )
32
+ jdata = json .loads (resp .read ())['short' ]
33
+ if jdata ['error' ]['code' ] != 0 :
34
+ raise ShortyError (jdata ['error' ]['msg' ])
35
+ return str (jdata ['shortened' ])
36
+
Original file line number Diff line number Diff line change @@ -214,6 +214,40 @@ def shrink(self, bigurl):
214
214
215
215
fwd4me = Fwd4me ()
216
216
217
+ # shortie
218
+ class Shortie (Service ):
219
+
220
+ def __init__ (self , email = None , secretkey = None ):
221
+ self .email = email
222
+ self .secretkey = secretkey
223
+
224
+ def _test (self ):
225
+ # prompt for email and key
226
+ self .email = raw_input ('shortie email: ' )
227
+ self .secretkey = raw_input ('shortie secretKey: ' )
228
+
229
+ Service ._test (self )
230
+
231
+ def shrink (self , bigurl , tag = None , private = False ):
232
+ if self .email is None or self .secretkey is None :
233
+ raise ShortyError ('Must provide an email and secretkey' )
234
+ parameters = {
235
+ 'email' : self .email , 'secretKey' : self .secretkey ,
236
+ 'format' : 'json' ,
237
+ 'url' : bigurl
238
+ }
239
+ if tag :
240
+ parameters ['custom' ] = tag
241
+ if private :
242
+ parameters ['private' ] = 'true'
243
+ resp = request ('http://short.ie/api' , parameters )
244
+ jdata = json .loads (resp .read ())['short' ]
245
+ if jdata ['error' ]['code' ] != 0 :
246
+ raise ShortyError (jdata ['error' ]['msg' ])
247
+ return str (jdata ['shortened' ])
248
+
249
+ shortie = Shortie ()
250
+
217
251
# isgd
218
252
class Isgd (Service ):
219
253
@@ -592,6 +626,7 @@ def expand(self, tinyurl):
592
626
'tinyurl.com' : tinyurl ,
593
627
'bit.ly' : bitly ,
594
628
'fwd4.me' : fwd4me ,
629
+ 'short.ie' : shortie ,
595
630
'sandbox.com' : sandbox ,
596
631
}
597
632
You can’t perform that action at this time.
0 commit comments