Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f94da4

Browse files
committed
Implemented budurl.com service.
1 parentafb5026 commit3f94da4

File tree

4 files changed

+75
-3
lines changed

4 files changed

+75
-3
lines changed

‎README‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Supported URL shortening services for shrinking long urls:
3232
chilp.it
3333
short.ie
3434
short.to
35+
to.ly
36+
budurl.com
3537

3638
Shorty can expand any url service by getting the redirect
3739
location by requesting the tiny url.

‎TODO‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ API available and ready to go!
22
++++++++++++++++++++++++++++++
33
+ burnurl.com
44
+ u.mavrev.com
5-
+ budurl.com
65
+ snipr.com/snipurl.com/sn.im
76
+ kl.am
87
+ adjix.com
98
+ metamark.net (xrl.us)
109
+ idek.net
1110
+ xr.com
12-
+ to.ly
1311
+ easyuri.com
1412
+ rubyurl.com
1513
+ hurl.ws

‎services/budurl.py‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Shorty
2+
## Copyright 2009 Joshua Roesslein
3+
## See LICENSE
4+
5+
## @url budurl.com
6+
classBudurl(Service):
7+
8+
def__init__(self,apikey=None):
9+
self.apikey=apikey
10+
11+
def_test(self):
12+
#prompt for apikey
13+
self.apikey=raw_input('budurl apikey: ')
14+
Service._test(self)
15+
16+
defshrink(self,bigurl,notes=None):
17+
ifself.apikeyisNone:
18+
raiseShortyError('Must set an apikey')
19+
parameters= {'long_url':bigurl,'api_key':self.apikey}
20+
ifnotes:
21+
parameters['notes']=notes
22+
resp=request('http://budurl.com/api/v1/budurls/shrink',parameters)
23+
jdata=json.loads(resp.read())
24+
ifjdata['success']!=1:
25+
raiseShortyError(jdata['error_message'])
26+
else:
27+
returnstr(jdata['budurl'])
28+
29+
defexpand(self,tinyurl):
30+
resp=request('http://budurl.com/api/v1/budurls/expand', {'budurl':tinyurl})
31+
jdata=json.loads(resp.read())
32+
ifjdata['success']!=1:
33+
raiseShortyError(jdata['error_message'])
34+
else:
35+
returnstr(jdata['long_url'])
36+

‎shorty.py‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ class Toly(Service):
292292
defshrink(self,bigurl):
293293
resp=request('http://to.ly/api.php', {'longurl':bigurl})
294294
returnresp.read()
295+
295296
toly=Toly()
296297

297298
# fongs
@@ -399,6 +400,40 @@ def expand(self, tinyurl):
399400

400401
bitly=Bitly()
401402

403+
# budurl
404+
classBudurl(Service):
405+
406+
def__init__(self,apikey=None):
407+
self.apikey=apikey
408+
409+
def_test(self):
410+
#prompt for apikey
411+
self.apikey=raw_input('budurl apikey: ')
412+
Service._test(self)
413+
414+
defshrink(self,bigurl,notes=None):
415+
ifself.apikeyisNone:
416+
raiseShortyError('Must set an apikey')
417+
parameters= {'long_url':bigurl,'api_key':self.apikey}
418+
ifnotes:
419+
parameters['notes']=notes
420+
resp=request('http://budurl.com/api/v1/budurls/shrink',parameters)
421+
jdata=json.loads(resp.read())
422+
ifjdata['success']!=1:
423+
raiseShortyError(jdata['error_message'])
424+
else:
425+
returnstr(jdata['budurl'])
426+
427+
defexpand(self,tinyurl):
428+
resp=request('http://budurl.com/api/v1/budurls/expand', {'budurl':tinyurl})
429+
jdata=json.loads(resp.read())
430+
ifjdata['success']!=1:
431+
raiseShortyError(jdata['error_message'])
432+
else:
433+
returnstr(jdata['long_url'])
434+
435+
budurl=Budurl()
436+
402437
# trim
403438
classTrim(Service):
404439

@@ -634,7 +669,7 @@ def expand(self, tinyurl):
634669
services= {
635670
'a.gd':agd,
636671
'short.to':shortto,
637-
'chilp.it':chilpit,
672+
'budurl.com':budurl,
638673
'digg.com':digg,
639674
'tweetburner.com':tweetburner,
640675
'tr.im':trim,
@@ -644,6 +679,7 @@ def expand(self, tinyurl):
644679
'urlborg.com':urlborg,
645680
'is.gd':isgd,
646681
'fon.gs':fongs,
682+
'chilp.it':chilpit,
647683
'ub0.cc':urlborg,
648684
'tinyurl.com':tinyurl,
649685
'bit.ly':bitly,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp