@anywhere tweetbox,缩短网址

时间:2011-11-01 03:47:07

标签: twitter url-shortener twitter-anywhere

我使用Twitter进行博客的引用。我将来自@anywhere应用程序的tweetbox放到我的每个帖子中。它有默认内容,即帖子的URL。 我想缩短它,怎么办呢?使用t.co的服务?

2 个答案:

答案 0 :(得分:0)

您可以使用bit.ly的服务。 API非常方便,易于集成。

参考以下文档并探索更多内容。

http://code.google.com/p/bitly-api/wiki/ApiDocumentation

答案 1 :(得分:0)

不幸的是,T.co无法作为开发人员的API。这是Twitter用来自动缩短长链接的内部缩写。

查看Twitter开发人员this post by Raffi,了解有关它的更多信息。

您将无法控制链接缩短的方式。但是所有超过20个字符的网址都会自动缩短,您可以通过在发送给Twitter的wrap_links=true上添加POST来获取缩短的内容。

如果您在响应中启用了实体,则会看到链接的以下属性。

"urls": [
        {
          "url": "http://t.co/0JG5Mcq",
          "display_url": "blog.twitter.com/2011/05/twitte…",
          "expanded_url": "http://blog.twitter.com/2011/05/twitter-for-mac-update.html",
          "indices": [
            84,
            103
          ]
        }
      ],

供进一步参考:

Twitter's t.co URL wrapper is now on for all URLs 19 characters and greater

Next steps with the t.co link wrapper

相关问题