url-shortenergoo.gl

Length of goo.gl URL's


I'm using the goo.gl link shortener API in my app to send urls to twitter along with a link. I've been allowing users to submit 119 characters, appending a space, and then the URL because I was under the impression that they were always 19 characters. This should leave me with one to spare.

Unfortunately I've been getting some "tweet is too long" errors and I can't seem to find any documentation about the possible range of goo.gl url lengths. Does anyone know what the max is or know where some reliable documentation on it is?


Solution

  • Twitter now automatically shortens all links by itself, using t.co. Don't do it by yourself.

    Read: https://dev.twitter.com/docs/tco-link-wrapper/faq#How_do_I_calculate_if_a_Tweet_with_a_link_is_going_to_be_over_140_characters_or_not

    If you are not using the opt-in features, only links shorter in length than a t.co URL will be wrapped by t.co. All links t.co-length or longer should be considered as t.co's maximum length. For example, if help/configuration reports 20 characters as the maximum length, and a user posts a link that is 125 characters long, it should be considered as 20 characters long instead. If they post a link that is 18 characters long, it's still only 18 characters long.

    At the moment short_url_length is equal 22 (https://api.twitter.com/1/help/configuration.json)