nicolassmith / urlevaluator

URL evaluator for android - lengthens shortened URLs for correct handling in android
https://play.google.com/store/apps/details?id=com.github.nicolassmith.urlevaluator
Other
17 stars 3 forks source link

Support for Facebook's redirects #25

Open ilarrain opened 10 years ago

ilarrain commented 10 years ago

Could you please support URL redirects like the ones used in Facebook (app and web):

http://m.facebook.com/l.php?u=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6EljX5-Wgbo&h=hAQFjcT-z&s=1&enc=AZNtxdfNetPkrqslmByHfyWQe6ZvDJ-ZR0m63nKa2Gr0NkgkcCDos-Np8JPmtNXVG68

They seem to follow the structure: http(s)://(m.)facebook.com/l.php?u=[URL]&[JUNK]

This is not a short URL, and it works quite differently, nonetheless it produces the same kind of annoyances.

duetosymmetry commented 10 years ago

I agree that this is annoying but suspect that the "right" thing to do would be for the FB app to itself handle these links. As far as I know the purpose of these links is for FB to be able to control spammy links. I'm interested in what the redirector does with a link that FB deems as spammy. Do you have an example of a link that FB doesn't want to forward?

nicolassmith commented 10 years ago

Are these links spawned from within the facebook app? If they are sent to the browser then I guess this is just analytics.

I don't use the facebook app so cannot test, but implementation will be similar to what I've done for analytic type links that come from the woot check app, see:

https://github.com/nicolassmith/urlevaluator/blob/master/src/com/github/nicolassmith/urlevaluator/WootcheckEvaluatorTask.java

So just some subclass of Evaluator Task which parses the link for the url. Then in the UrlEvaluatorActivity can loop through all the various Evaluator tasks, and fall back to GeneralEvaluatorTask if none of the specialized ones match.

Of course it's important that it doesn't reduce some user-benefiting functionality as duetosymmetry points out.

I would accept a pull request which implements a FacebookEvaluatorTask, then I could glue it in. (or take a stab at the second part and I'll accept if I like it).

TPS commented 1 year ago

https://github.com/svenjacobs/leon solves this.