对缩短URL的还原

互联网上已经有很多提供长url缩短的服务提供网站,例如http://goo.gl/http://tinyurl.com/http://bitly.com/等等,而且它们不仅提供在线的缩短服务,还开放进行缩短的api,供开发者调用。

 

反之,也可以利用http://untiny.me/进行缩短url的还原,它能还原几乎所有的缩短服务提供商缩短的url。

在线的还原没什么可说的,这里说一下怎么用它提供的api进行还原。

 

参考http://untiny.me/api/#service=1,这里说得挺详细。

使用示例:

http://untiny.me/api/1.0/extract/?format=text&url=http://goo.gl/h2n2
返回:
http://hi.baidu.com/amauri3389

 

附带备注一下新浪微博的域名缩短和还原的api接口

http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2

 

缩短是short_url/shorten,还原是short_url/expand

使用很简单,都是get方式,例如:

https://api.weibo.com/2/short_url/expand.json?source=828305473&url_short=http://t.cn/zWqK6Nc

https://api.weibo.com/2/short_url/shorten.json?source=828305473&url_long=http://china.newssc.org/system/2012/07/05/013565372.shtml

source换成自己的app key就好了。。

猜你喜欢

转载自tonl.iteye.com/blog/1746111
URL
今日推荐