• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[MOD][XPOSED] CrappaLinks - remove link masking/tracking/shortening from various apps

Search This thread

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,792
Introduction
Some apps redirect all external links through their servers. This breaks intent filters (which means you can't open Play Store links with the Play Store, GitHub links with the GitHub app, etc - you're forced to use a browser to get past the redirection.)
This module removes the crappy link redirection/masking/tracking from various apps.
Also, if URL unshortening is enabled, the module will also try to resolve shortened URLs before opening them. This means that e.g. shortened links leading to YouTube (for example: http://bit.ly/1gf00Wo) can be directly opened in the YouTube app.
If you still don't understand what this module does, you can read a detailed example here.

Requirements:

Non root users can use this app.

Requests:
For apps: When requesting support for an app you use, include its download link (e.g. Play Store.)
Since it's unlikely I'm also using whatever app you want, I also need detailed information if e.g. link masking only happens in certain parts, and getting there isn't straightforward.
Also gives an example of how the URL is formatted (what *should* open, and what is opening instead.) For example, this is what happens for the Play Store:
Code:
What should open: http://xda-developers.com
What is actually being opened because of the app's link masking: http://google.com/?q=[COLOR="Red"]http://xda-developers.com[/COLOR]&sa=asnfioASFOASh01aF
... and I'll try my best to support it.
For URL shorteners: URL shorteners that require user interaction, such as Adfly, won't be supported.

Of course, pull requests are very welcome if you can do add support for it by yourself. :)

Reporting Issues:
Please include a non-filtered logcat when reporting issues, as well as the full URL if applicable.
The best way to include a logcat is to use a pastebin such as bpaste.net, pastie.org, or ix.io.
Do not use the Xposed Installer's "Log" section, as that's not made to give the full logcat.

Supported shorteners/hosts:
CrappaLinks supports the following URL shorteners:
"t.co", "youtu.be", "bit.ly", "menea.me", "kcy.me", "goo.gl", "ow.ly", "j.mp", "redes.li", "dlvr.it", "tinyurl.com", "tmblr.co", "reut.rs", "sns.mx", "wp.me", "4sq.com", "ed.cl", "huff.to", "mun.do", "cos.as", "flip.it", "amzn.to", "cort.as", "on.cnn.com", "fb.me", "shar.es", "spr.ly", "v.ht", "v0v.in", "redd.it", "bitly.com", "tl.gd", "wh.gov", "hukd.mydealz.de", "untp.i", "kck.st", "engt.co", "nyti.ms", "cnnmon.ie", "vrge.co", "is.gd", "cnn.it", "spon.de", "affiliation.appgratuites-network.com", "t.cn", "url.cn", "ht.ly", "po.st", "ohmyyy.gt", "dustn.ws", "glm.io", "nazr.in", "chip.biz", "ift.tt", "dopice.sk", "phon.es", "buff.ly", "htn.to", "trib.al", "mhlthm.ag", "nerdi.st", "pulse.me", "y2u.be", "feedproxy.google.com", "mdk.to"

And these hosts for masked URLs:
"m.facebook.com", "link2.tapatalk.com", "link.tapatalk.com", "google.com", "vk.com", "click.linksynergy.com", "youtube.com", "m.scope.am", "redirectingat.com", "jdoqocy.com", "viglink.com", "youtube.com" (for attribution links), "pt.tapatalk.com", "getpocket.com", "news.google.com", "mandrillapp.com"


Source code:
https://github.com/GermainZ/CrappaLinks

Download:
http://repo.xposed.info/module/com.germainz.crappalinks

Changelog:
2.8:
2.7.2:
  • Fix for absolute URLs
  • Ignore <noscript> meta refreshes
  • Resolve All URLs: 'Only on WiFi' option
  • New URL shorteners: glm.io, nazr.in, chip.biz, ift.tt, dopice.sk, phon.es, buff.ly
  • New URL masker: getpocket.com
2.7:
  • Added option to use the LongURL API to unshorten URLs.
  • Added Google Forms link to submit new URLs.
  • Added dustn.ws to URL shorteners.
  • Bug fixes.
  • Updated Slovak and Chinese translations.
2.6:
  • Added new maskers: pt.tapatalk.com (support for the latest TapaTalk versions.)
  • Added new shorteners: ht.ly, po.st, ohmyyy.gt.
  • Avoid infinite loops if the URL can't be unmasked correctly.
  • Translations: added Russian, Brazilian Portuguese, updated Slovak.
2.5:
  • Try to detect meta tag redirects for all hosts.
  • Use CookieManager to store cookies. This is necessary for e.g. nytimes which kept redirecting us in a loop otherwise.
  • Go back to using the default user agent, setting a custom one was apparently messing up some requests.
2.4:
  • Add preference to disable resolving all URLs: *after* clicking a shortened URL and resolving it once, only known URL shorteners will be resolved. Consumes less bandwidth, but may not resolve all *nested* shortened URLs correctly. Example: goo.gl/something (known; resolve) -> tinyurl.com/something (known; resolve) -> some-unknown-shortener.com (unknown; do not resolve) -> ???
  • Spoof Firefox for Android's User Agent. This may be useful when the "Resolve All URLs" option is checked, as websites will send us the mobile versions instead (less bandwidth consumption.)
  • Use correct hook for ICS (the module wasn't working correctly for ICS devices.)
  • Fixed Dutch translation.
  • Avoid infinite loops.
2.3:
  • Add support for YouTube attribution links.
  • Add Dutch and Greek translations.
  • Update German translation.
2.2:
  • Confirmation dialog: handle back button;
  • Don't ignore unshortened links (useful for a masked URL inside a shortened one);
  • Handle subdomains for masked/shortened URLs and fix CrappaLinks ignoring those starting with "www.";
  • Better connection error feedback;
  • Chinese translation;
  • Added URL shortners: t.cn, url.cn;
  • Updated German translation.
2.1:
  • Added option to show a confirmation dialog before opening unshortened URLs;
  • Fix issue with redirects that use relative Locations;
  • Added support for more hosts. apicdn.viglink.com, affiliation.appgratuites-network.com, spon.de.
2.0.2: Preserve the intent type (fixes bug with e.g. heise online.)
2.0.1: Bug fix, some URLs were detected as being masked when they shouldn't be (which caused an infinite loop.)
2.0: System wide support.
1.7.2: TapaTalk v2 bug fix.
1.7.1: Facebook bug fix.
1.7:
  • New icon;
  • Fix slight issue with some Facebook links not being unmasked;
  • Added support for TapaTalk v2;
  • Bug fixes with Vk and the Play Store;
  • Added support for Slickdeals;
  • Added support for myDealZ;
  • Added preference to hide icon from launcher;
1.6: Added support for URL unshortening. You can turn this off if you want.
1.5: Added support for Scope.
1.4: Added support for Facebook and Vk.
1.3: Added Google Play support.
1.2: Added support for XDA Premium.
1.1: Possible fix for some links.
1.0: Initial release. Only supports TapaTalk.

Thanks:
  • rovo89 and Tungstwenty for the Xposed Framework;
  • AChep for helping and testing various stuff;
  • julianjm for helping out with URL resolving;
  • DD-Ripper for the app's icon;
  • All translators and testers.
 
Last edited:

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,792
Fantastic idea! This prevents also Tapatalk to "inspect" opened links...
Didn't look too much into the code, but I think TapaTalk just knows the URL has been opened - not who opened it.
EDIT: Actually, they have the device id. The link you open (link.tapatalk.com/...) has a "VigLinkId" which is sent by their servers (as a response to the device id (MAC address) being sent, among other things) if I'm not mistaken. So the two can be linked.

How in time! Just having a discussion regarding this here:
http://forum.xda-developers.com/showthread.php?t=2528576

There's also an app that was posted.
Cool, didn't know.
 
Last edited:

Tungstwenty

Senior Member
Nov 1, 2011
1,828
4,512
Doesn't this break the current functionality that if the link you click is part of the thread (of of the forum, for that matter), it will open still in TapaTalk instead of going to the browser?

Not using TapaTalk BTW, that's why I didn't test before commenting :)
 
  • Like
Reactions: zephyr1100

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,792
Doesn't this break the current functionality that if the link you click is part of the thread (of of the forum, for that matter), it will open still in TapaTalk instead of going to the browser?

Not using TapaTalk BTW, that's why I didn't test before commenting :)

Nope :) I'm replacing a method that only masks the URL and sends the intent to view it.
 
Last edited:

defim

Senior Member
Feb 18, 2012
2,744
1,487
@GermainZ:

Just wondering:
Code:
if (!pkg.equals("com.quoord.tapatalkpro.activity") && !pkg.equals("com.quoord.tapatalkHD"))

final Class<?> TagHandler = findClass("com.quoord.tapatalkpro.adapter.forum.MessageContentAdapter", lpparam.classLoader);

The class starts for both apps with "com.quoord.tapatalkpro" ?


An idea for another Tapatalk module: Remove in-post tapatalk signatures. As you know tapatalk a little, maybe you are able todo it? The signatures are in the resources like "<string name="tapatalk_singature_3">Sent from my %s</string>"
 

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,792
@GermainZ:

Just wondering:
Code:
if (!pkg.equals("com.quoord.tapatalkpro.activity") && !pkg.equals("com.quoord.tapatalkHD"))

final Class<?> TagHandler = findClass("com.quoord.tapatalkpro.adapter.forum.MessageContentAdapter", lpparam.classLoader);

The class starts for both apps with "com.quoord.tapatalkpro" ?


An idea for another Tapatalk module: Remove in-post tapatalk signatures. As you know tapatalk a little, maybe you are able todo it? The signatures are in the resources like "<string name="tapatalk_singature_3">Sent from my %s</string>"

Yes, same class name.
No, I can't do that (and have no interest TBH) because you're talking about your own signature. Tapatalk signatures are actually just part of the post with no way to identify them.
 
  • Like
Reactions: Bob823

defim

Senior Member
Feb 18, 2012
2,744
1,487

GermainZ

Inactive Recognized Developer / Retired Forum Mod
Aug 3, 2012
6,174
8,792
You're saying there's a more appropriate thread to request a module that bypasses redirects than a thread for a module that bypasses redirects?

Sent from my Nexus 5 using Tapatalk

This module is intended only for TapaTalk, it's not a universal module. I believe that's clearly stated in the OP. :) Ask in the appropriate thread instead (the one for questions and requests, link.)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 240
    Introduction
    Some apps redirect all external links through their servers. This breaks intent filters (which means you can't open Play Store links with the Play Store, GitHub links with the GitHub app, etc - you're forced to use a browser to get past the redirection.)
    This module removes the crappy link redirection/masking/tracking from various apps.
    Also, if URL unshortening is enabled, the module will also try to resolve shortened URLs before opening them. This means that e.g. shortened links leading to YouTube (for example: http://bit.ly/1gf00Wo) can be directly opened in the YouTube app.
    If you still don't understand what this module does, you can read a detailed example here.

    Requirements:

    Non root users can use this app.

    Requests:
    For apps: When requesting support for an app you use, include its download link (e.g. Play Store.)
    Since it's unlikely I'm also using whatever app you want, I also need detailed information if e.g. link masking only happens in certain parts, and getting there isn't straightforward.
    Also gives an example of how the URL is formatted (what *should* open, and what is opening instead.) For example, this is what happens for the Play Store:
    Code:
    What should open: http://xda-developers.com
    What is actually being opened because of the app's link masking: http://google.com/?q=[COLOR="Red"]http://xda-developers.com[/COLOR]&sa=asnfioASFOASh01aF
    ... and I'll try my best to support it.
    For URL shorteners: URL shorteners that require user interaction, such as Adfly, won't be supported.

    Of course, pull requests are very welcome if you can do add support for it by yourself. :)

    Reporting Issues:
    Please include a non-filtered logcat when reporting issues, as well as the full URL if applicable.
    The best way to include a logcat is to use a pastebin such as bpaste.net, pastie.org, or ix.io.
    Do not use the Xposed Installer's "Log" section, as that's not made to give the full logcat.

    Supported shorteners/hosts:
    CrappaLinks supports the following URL shorteners:
    "t.co", "youtu.be", "bit.ly", "menea.me", "kcy.me", "goo.gl", "ow.ly", "j.mp", "redes.li", "dlvr.it", "tinyurl.com", "tmblr.co", "reut.rs", "sns.mx", "wp.me", "4sq.com", "ed.cl", "huff.to", "mun.do", "cos.as", "flip.it", "amzn.to", "cort.as", "on.cnn.com", "fb.me", "shar.es", "spr.ly", "v.ht", "v0v.in", "redd.it", "bitly.com", "tl.gd", "wh.gov", "hukd.mydealz.de", "untp.i", "kck.st", "engt.co", "nyti.ms", "cnnmon.ie", "vrge.co", "is.gd", "cnn.it", "spon.de", "affiliation.appgratuites-network.com", "t.cn", "url.cn", "ht.ly", "po.st", "ohmyyy.gt", "dustn.ws", "glm.io", "nazr.in", "chip.biz", "ift.tt", "dopice.sk", "phon.es", "buff.ly", "htn.to", "trib.al", "mhlthm.ag", "nerdi.st", "pulse.me", "y2u.be", "feedproxy.google.com", "mdk.to"

    And these hosts for masked URLs:
    "m.facebook.com", "link2.tapatalk.com", "link.tapatalk.com", "google.com", "vk.com", "click.linksynergy.com", "youtube.com", "m.scope.am", "redirectingat.com", "jdoqocy.com", "viglink.com", "youtube.com" (for attribution links), "pt.tapatalk.com", "getpocket.com", "news.google.com", "mandrillapp.com"


    Source code:
    https://github.com/GermainZ/CrappaLinks

    Download:
    http://repo.xposed.info/module/com.germainz.crappalinks

    Changelog:
    2.8:
    2.7.2:
    • Fix for absolute URLs
    • Ignore <noscript> meta refreshes
    • Resolve All URLs: 'Only on WiFi' option
    • New URL shorteners: glm.io, nazr.in, chip.biz, ift.tt, dopice.sk, phon.es, buff.ly
    • New URL masker: getpocket.com
    2.7:
    • Added option to use the LongURL API to unshorten URLs.
    • Added Google Forms link to submit new URLs.
    • Added dustn.ws to URL shorteners.
    • Bug fixes.
    • Updated Slovak and Chinese translations.
    2.6:
    • Added new maskers: pt.tapatalk.com (support for the latest TapaTalk versions.)
    • Added new shorteners: ht.ly, po.st, ohmyyy.gt.
    • Avoid infinite loops if the URL can't be unmasked correctly.
    • Translations: added Russian, Brazilian Portuguese, updated Slovak.
    2.5:
    • Try to detect meta tag redirects for all hosts.
    • Use CookieManager to store cookies. This is necessary for e.g. nytimes which kept redirecting us in a loop otherwise.
    • Go back to using the default user agent, setting a custom one was apparently messing up some requests.
    2.4:
    • Add preference to disable resolving all URLs: *after* clicking a shortened URL and resolving it once, only known URL shorteners will be resolved. Consumes less bandwidth, but may not resolve all *nested* shortened URLs correctly. Example: goo.gl/something (known; resolve) -> tinyurl.com/something (known; resolve) -> some-unknown-shortener.com (unknown; do not resolve) -> ???
    • Spoof Firefox for Android's User Agent. This may be useful when the "Resolve All URLs" option is checked, as websites will send us the mobile versions instead (less bandwidth consumption.)
    • Use correct hook for ICS (the module wasn't working correctly for ICS devices.)
    • Fixed Dutch translation.
    • Avoid infinite loops.
    2.3:
    • Add support for YouTube attribution links.
    • Add Dutch and Greek translations.
    • Update German translation.
    2.2:
    • Confirmation dialog: handle back button;
    • Don't ignore unshortened links (useful for a masked URL inside a shortened one);
    • Handle subdomains for masked/shortened URLs and fix CrappaLinks ignoring those starting with "www.";
    • Better connection error feedback;
    • Chinese translation;
    • Added URL shortners: t.cn, url.cn;
    • Updated German translation.
    2.1:
    • Added option to show a confirmation dialog before opening unshortened URLs;
    • Fix issue with redirects that use relative Locations;
    • Added support for more hosts. apicdn.viglink.com, affiliation.appgratuites-network.com, spon.de.
    2.0.2: Preserve the intent type (fixes bug with e.g. heise online.)
    2.0.1: Bug fix, some URLs were detected as being masked when they shouldn't be (which caused an infinite loop.)
    2.0: System wide support.
    1.7.2: TapaTalk v2 bug fix.
    1.7.1: Facebook bug fix.
    1.7:
    • New icon;
    • Fix slight issue with some Facebook links not being unmasked;
    • Added support for TapaTalk v2;
    • Bug fixes with Vk and the Play Store;
    • Added support for Slickdeals;
    • Added support for myDealZ;
    • Added preference to hide icon from launcher;
    1.6: Added support for URL unshortening. You can turn this off if you want.
    1.5: Added support for Scope.
    1.4: Added support for Facebook and Vk.
    1.3: Added Google Play support.
    1.2: Added support for XDA Premium.
    1.1: Possible fix for some links.
    1.0: Initial release. Only supports TapaTalk.

    Thanks:
    • rovo89 and Tungstwenty for the Xposed Framework;
    • AChep for helping and testing various stuff;
    • julianjm for helping out with URL resolving;
    • DD-Ripper for the app's icon;
    • All translators and testers.
    15
    2.6 out. Changes:
    • Added new maskers: pt.tapatalk.com (support for the latest TapaTalk versions.)
    • Added new shorteners: ht.ly, po.st, ohmyyy.gt.
    • Avoid infinite loops if the URL can't be unmasked correctly.
    • Translations: added Russian, Brazilian Portuguese, updated Slovak.
    15
    Here's a new build to test :)
    CrappaLinks-2.9-test.apk

    Changelog:

    • Migrate from longurl.org to Unshorten.It!
    • Add support for new URL maskers: go.theregister.com, securitylab.ru, saviry.co, libnads.xl.co.id, googleadservices.com.
    • Improved support for the following URL maskers: facebook.com, google.com, viglink.com.
    • Add support for new URL shorteners: "ppt.cc", "feeds.gawker.com", "tinylinks.co", "vk.cc", "rch.lt", "mynt.to", "brt.st", "kom.ps", "urly.fi", "qklnk.co", "hec.su", "tr.im", "qr.ae", "full.sc", "smo.sh", "bit.do", "shar.as", "email.ifttt.com".
    • redd.it links are now directly expanded.
    • The CrappaLinks confirmation dialog will now use the device default theme (it'll no longer show as a Holo dialog on newer Android versions).
    • Crash fixes.

    Some of the changes may have caused some URL maskers to stop being detected correctly. Please let me know if you find any.

    I took care of most of the requests in the Google Form (link). Some requests were missing info (marked in yellow), others I skipped for the time being as they might take some time (no background color). For the latter, please feel free to post about it here if it's important to you so I can focus on it.
    15
    Update:
    2.4:
    • Add preference to disable resolving all URLs: *after* clicking a shortened URL and resolving it once, only known URL shorteners will be resolved. Consumes less bandwidth, but may not resolve all *nested* shortened URLs correctly. Example: goo.gl/something (known; resolve) -> tinyurl.com/something (known; resolve) -> some-unknown-shortener.com (unknown; do not resolve) -> ???
    • Spoof Firefox for Android's User Agent. This may be useful when the "Resolve All URLs" option is checked, as websites will send us the mobile versions instead (less bandwidth consumption.)
    • Use correct hook for ICS (the module wasn't working correctly for ICS devices.)
    • Fixed Dutch translation.
    • Avoid infinite loops.
    15
    Of course I have, why would I download anything without reading the OP? I know I am clearly misunderstanding something, and I am just trying to understand.
    No problem, just making sure. :)

    Let's take Facebook as our example since you mentioned that. Say your friend posted a link to www.xda-developers.com. Now, if you click that link from the Facebook app it'll open something like http://m.facebook.com/l.php?q=www.xda-developers.com instead.

    This module causes it to directly open the correct link instead : www.xda-developers.com

    If you're opening a forum page or a YouTube link from within Facebook, you'll notice you won't be able to open it with the Tapatalk or YouTube app. Instead, you need to open it in your browser to bypass the link masking we talked about above.
    With this module, you can directly open it in the Tapatalk/YouTube app.

    Another advantage is that you protect your privacy by not allowing these apps to track you anymore. This doesn't apply to apps that shorten the URLs server side/shortened URLs, though, only for normal links in apps that either mask it or shorten it client side.

    I hope that's clear enough.