File tree Expand file tree Collapse file tree 3 files changed +39
-2
lines changed Expand file tree Collapse file tree 3 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Supported URL shortening services for shrinking long urls:
22
22
buk.me
23
23
fon.gs
24
24
fwd4.me
25
+ chilp.it
25
26
26
27
Shorty can expand any url service by getting the redirect
27
28
location by requesting the tiny url.
Original file line number Diff line number Diff line change 1
1
+ burnurl.com
2
- + chilp.it
Original file line number Diff line number Diff line change @@ -465,6 +465,42 @@ def shrink(self, bigurl):
465
465
466
466
fwd4me = Fwd4me ()
467
467
468
+ # chilp.it
469
+ class Chilpit (Service ):
470
+
471
+ def shrink (self , bigurl ):
472
+ resp = request ('http://chilp.it/api.php' , {'url' : bigurl })
473
+ url = resp .read ()
474
+ if url .startswith ('http://' ):
475
+ return url
476
+ else :
477
+ raise ShortyError (url )
478
+
479
+ def expand (self , tinyurl ):
480
+ turl = urlparse (tinyurl )
481
+ if turl .netloc .lstrip ('www.' ) != 'chilp.it' :
482
+ raise ShortyError ('Not a chilp.it url' )
483
+ resp = request ('http://p.chilp.it/api.php?' + turl .path .strip ('/' ))
484
+ url = resp .read ()
485
+ if url .startswith ('http://' ):
486
+ return url
487
+ else :
488
+ raise ShortyError (url )
489
+
490
+ # get click stats of the tinyurl
491
+ def stats (self , tinyurl ):
492
+ turl = urlparse (tinyurl )
493
+ if turl .netloc .lstrip ('www.' ) != 'chilp.it' :
494
+ raise ShortyError ('Not a chilp.it url' )
495
+ resp = request ('http://s.chilp.it/api.php?' + turl .query )
496
+ hit_count = resp .read ()
497
+ try :
498
+ return int (hit_count )
499
+ except :
500
+ raise ShortyError ('Url not found or invalid' )
501
+
502
+ chilpit = Chilpit ()
503
+
468
504
"""Mapping of domain to service class"""
469
505
services = {
470
506
'sandbox' : sandbox ,
@@ -479,7 +515,8 @@ def shrink(self, bigurl):
479
515
'a.gd' : agd ,
480
516
'buk.me' : bukme ,
481
517
'fon.gs' : fongs ,
482
- 'fwd4.me' : fwd4me
518
+ 'fwd4.me' : fwd4me ,
519
+ 'chilp.it' : chilpit
483
520
}
484
521
485
522
"""
You can’t perform that action at this time.
0 commit comments