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

Commitafb5026

Browse files
committed
Small change to short.to service. Implemented to.ly service.
1 parentd8410ec commitafb5026

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

‎services/shortto.py‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,5 @@ def shrink(self, bigurl):
1111

1212
defexpand(self,tinyurl):
1313
resp=request('http://long.to/do.txt', {'url':tinyurl})
14-
url=resp.read()
15-
ifurl.startswith('http'):
16-
returnurl
17-
else:
18-
raiseShortyError(url)
14+
returnresp.read()
1915

‎services/toly.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Shorty
2+
## Copyright 2009 Joshua Roesslein
3+
## See LICENSE
4+
5+
## @url to.ly
6+
classToly(Service):
7+
8+
defshrink(self,bigurl):
9+
resp=request('http://to.ly/api.php', {'longurl':bigurl})
10+
returnresp.read()
11+

‎shorty.py‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ def expand(self, tinyurl):
286286

287287
cligs=Cligs()
288288

289+
# toly
290+
classToly(Service):
291+
292+
defshrink(self,bigurl):
293+
resp=request('http://to.ly/api.php', {'longurl':bigurl})
294+
returnresp.read()
295+
toly=Toly()
296+
289297
# fongs
290298
classFongs(Service):
291299

@@ -471,11 +479,7 @@ def shrink(self, bigurl):
471479

472480
defexpand(self,tinyurl):
473481
resp=request('http://long.to/do.txt', {'url':tinyurl})
474-
url=resp.read()
475-
ifurl.startswith('http'):
476-
returnurl
477-
else:
478-
raiseShortyError(url)
482+
returnresp.read()
479483

480484
shortto=Shortto()
481485

@@ -633,9 +637,9 @@ def expand(self, tinyurl):
633637
'chilp.it':chilpit,
634638
'digg.com':digg,
635639
'tweetburner.com':tweetburner,
636-
'buk.me':bukme,
637-
'twurl.nl':tweetburner,
638640
'tr.im':trim,
641+
'twurl.nl':tweetburner,
642+
'to.ly':toly,
639643
'cli.gs':cligs,
640644
'urlborg.com':urlborg,
641645
'is.gd':isgd,
@@ -646,5 +650,6 @@ def expand(self, tinyurl):
646650
'fwd4.me':fwd4me,
647651
'short.ie':shortie,
648652
'sandbox.com':sandbox,
653+
'buk.me':bukme,
649654
}
650655

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp