Any suggestions for a link UNshortener?
from jherazob@fedia.io to selfhosted@lemmy.world on 17 Sep 14:43
https://fedia.io/m/selfhosted@lemmy.world/t/2724984

Checking for this, i see that the only one was the old unshort.link, but the repo was discontinued

#selfhosted

threaded - newest

antsu@discuss.tchncs.de on 17 Sep 14:51 next collapse

I understand this is not exactly what you’re asking for, but if you have access to a terminal, you can “unshorten” a link with:

curl --head -L https://example.com/short | grep: location

DasFaultier@sh.itjust.works on 17 Sep 14:54 next collapse

Very much this.

jherazob@fedia.io on 17 Sep 16:18 collapse

It is not enough for the increasingly common share.google links for example, and i bet there's more like this

jherazob@fedia.io on 19 Sep 15:24 collapse

Received a share.google link and checked what it did: It redirects to something with URL format "https://www.google.com/share.google?q=SOME_CODE", which is a normal page that IS the target as far as curl and such tools are concerned but redirects on the browser probably using Javascript, so it will not redirect it with our normal tools. It will need custom code or Javascript execution. So, they knew what they were doing and used their powers for evil, as they usually do now.

solrize@lemmy.ml on 17 Sep 15:23 next collapse

It’s a little complicated. Sometimes the curl command further up works, but sometimes the redirection is done in an html meta tag or even with javascript. I have a messy python script that has a bunch of site specific code to bypass redirects and clean up tracking links. I can’t post it in its present condition (it has some private info embedded) but I’ve been wanting to clean it up and post it sometime.

EndOfLine@lemmy.world on 17 Sep 15:53 next collapse

I’ve not used it, but your question got me wondering so I searched and found the following site which tries to navigate various redirect methods to find the final destination. I’d be curious to know how well it works.

www.redirect-checker.org

jherazob@fedia.io on 17 Sep 16:19 collapse

I was hoping for a self-hosted resource, not a remote API, since this is the Selfhosted community

EndOfLine@lemmy.world on 17 Sep 16:49 collapse

Whoops, my mistake. I did not check where this was posted. Sorry about that.

jcolag@lemmy.sdf.org on 17 Sep 20:43 next collapse

I developed this script for creating permanent/static archives of social media exports, so it’s not a full solution - not a web service, expects file inputs, uses a probably incomplete list of shorteners to avoid pulling real pages - but it along with the shorteners.txt file in the same repository, iterating to find a domain not on the list, might at least inspire a solution, if it’s not good for your specific cases.

v3ritas@infosec.pub on 18 Sep 01:24 collapse

I’m sure there are better alternatives (going to look at some of the other suggestions here), but I usually just drop the link into www.expandurl.net