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

Commitd8410ec

Browse files
committed
Implemented short.to service.
1 parent99bc7dd commitd8410ec

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

‎README‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Supported URL shortening services for shrinking long urls:
3131
fwd4.me
3232
chilp.it
3333
short.ie
34+
short.to
3435

3536
Shorty can expand any url service by getting the redirect
3637
location by requesting the tiny url.

‎TODO‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ API available and ready to go!
22
++++++++++++++++++++++++++++++
33
+ burnurl.com
44
+ u.mavrev.com
5-
+ short.to
65
+ budurl.com
76
+ snipr.com/snipurl.com/sn.im
87
+ kl.am

‎services/shortto.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Shorty
2+
## Copyright 2009 Joshua Roesslein
3+
## See LICENSE
4+
5+
## @url short.to
6+
classShortto(Service):
7+
8+
defshrink(self,bigurl):
9+
resp=request('http://short.to/s.txt', {'url':bigurl})
10+
returnresp.read()
11+
12+
defexpand(self,tinyurl):
13+
resp=request('http://long.to/do.txt', {'url':tinyurl})
14+
url=resp.read()
15+
ifurl.startswith('http'):
16+
returnurl
17+
else:
18+
raiseShortyError(url)
19+

‎shorty.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,23 @@ def shrink(self, bigurl, tag=None, password=None, expires=None):
462462

463463
agd=Agd()
464464

465+
# shortto
466+
classShortto(Service):
467+
468+
defshrink(self,bigurl):
469+
resp=request('http://short.to/s.txt', {'url':bigurl})
470+
returnresp.read()
471+
472+
defexpand(self,tinyurl):
473+
resp=request('http://long.to/do.txt', {'url':tinyurl})
474+
url=resp.read()
475+
ifurl.startswith('http'):
476+
returnurl
477+
else:
478+
raiseShortyError(url)
479+
480+
shortto=Shortto()
481+
465482
# digg
466483
classDigg(Service):
467484

@@ -612,6 +629,7 @@ def expand(self, tinyurl):
612629

613630
services= {
614631
'a.gd':agd,
632+
'short.to':shortto,
615633
'chilp.it':chilpit,
616634
'digg.com':digg,
617635
'tweetburner.com':tweetburner,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp