Autolinker.js
Autolinker.js copied to clipboard
Handle Twitter URLs
Twitter changes a base URL to a t.co URL. Implement a way of handling that to show the original URL not the t.co URL.
Hey, not sure if I'm following exactly. Can you give an example of what is currently happening, and what you would like to happen instead?
From what I understand, if you have a http://t.co/foo that points to http://theoriginalurl.com it should link but also change the text of the url to http://theoriginalurl.com .
That would at least require a fetch, right ?
Should we then also do that for every shortener ? (bit.ly, etc.)
Just thinking out loud here.
Yeah, I'm running into this issue too.
If I'm using autolinker on a Twitter bio with a link, it replaces the original text to be linked with t.co/, which loses all the context.
Example:
Rendering 3dfordesigners.com ! 3D, visuals, interactive art; creative discipline from a technologist's perspective. Prev. @dropbox, @github, @codecademy.
Becomes:
Rendering t.co/dYunthyTN7! 3D, visuals, interactive art; creative discipline from a technologist's perspective. Prev. @dropbox, @github, @codecademy.
Is this still an issue? There's nothing in the Autolinker code that would convert a twitter url to t.co, so I'm not really understanding. Feel free to reopen with a better description though.
@gregjacobs, I have this problem right now. Twitter's t.co link shortening is user unfriendly because it adds tracking, latency, and makes the url opaque. (docs, docs)
Autolinker could add an async process to send a ping to the t.co url, and get back the redirect header to unfurl this URL to something more user friendly.
Ah! Ok, now I'm understanding. The ask is basically that Autolinker attempts to resolve t.co URLs to follow to the full URL that they point to.
So this is actually a decent amount of work to refactor Autolinker into an async utility that can handle something like this. Unfortunately I don't get a whole lot of time to work on Autolinker as it is, so PRs definitely welcome
I ended up postprocessing autolinker output as seen in the blogpost above but it's certainly not as elegant as making autolinker take async haha