Twitter URL shortener resolver (t.co links)

Since Twitter is wrapping all users links with their t.co URL shortener, the content you shared depends on t.co service.
It’s like a censorship, everything is hidden and controlled through t.co links. Maybe you don’t want Twitter to know how many times you clicked on a link? What would happen if this URL shortener won’t work anymore some days? All links you shared and the others users shared would be lost. It’s not good to rely only on a URL shortener, Twitter probably knows that and it may be the reason why they have embedded real URL in tweets HTML code.
This JavaScript lines will replace t.co links found on twitter.com with the real URL it refers to. You can use this script on-demand with Firefox scratchpad for example.

By default, this script returns the data-ultimate-url, interesting if a Twitter user has shared a link through another URL shortener like bit.ly, you can decode this link too. If data-ultimate-url is not found, it will search for the data-expanded-url, which returns only the t.co decoded link.

Download script from my server: twitter_uri_resolver.js
On Pastebin
On GitHub

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.