Autolinker.js icon indicating copy to clipboard operation
Autolinker.js copied to clipboard

Handle Twitter URLs

Open leyla-yazdan-hs opened this issue 8 years ago • 7 comments

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.

leyla-yazdan-hs avatar Nov 23 '16 21:11 leyla-yazdan-hs

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?

gregjacobs avatar Nov 25 '16 04:11 gregjacobs

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.

olafleur avatar Jan 17 '17 03:01 olafleur

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.

julesforrest avatar May 04 '17 17:05 julesforrest

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 avatar Dec 20 '18 21:12 gregjacobs

@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.

swyxio avatar Jun 12 '22 17:06 swyxio

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

gregjacobs avatar Jun 13 '22 18:06 gregjacobs

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

swyxio avatar Jun 18 '22 15:06 swyxio