1

I want to post a bit of script to Twitter which includes a URL. However, Twitter automatically sends URLs through its shortening service, with the (usually right, but in this case wrong) assumption that users would have wanted to do that anyway to save characters.

Is there any way to "escape" the URL so it doesn't get auto-shortened, but also so that the escape code doesn't get sent out as part of the tweet? The objective is to maintain the integrity of the script code in the tweet, such that all users (including those who may otherwise see a t.co link due to a faulty app or something) will see the code exactly as it is to be used in the script.

  • There's no way to do so, unless you do things like replace the dot with their literal terms (ie: stackexchange.com to stackexchange dot com) – Sathyajith Bhat Sep 16 '14 at 15:36
1

This won't completely avoid the URL shortening service, but it should generally serve the purpose of making what is displayed match what was written:

If the scripting language supports inline string concatenation, for the part where you need a URL, use that to break the domain name off from the rest of the URL.


Example

Instead of:

"http://foo.bar/qux.html"

use:

"http://"+"foo.bar"+"/qux.html"

or, if you can, just:

"foo.bar"+"/qux.html"

Twitter (and other clients which properly use Twitter's API) will still convert the domain to a hyperlink which targets a t.co URL. However, the hyperlink text should still just be the domain name as originally written.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.