FORUMS
Remove All Ads from XDA

[APP][MOD][4.4+] Instagram without ads and annoyances

32 posts
Thanks Meter: 77
 
By Grishka11, Member on 3rd May 2019, 07:38 PM
Post Reply Email Thread
Hi all. It seems like there's a lot of people annoyed by ads on Instagram. I was, too, until I figured out a novel way to patch it.

Changes
  • Removed ads in the feed.
  • Removed ads in stories.
  • Removed "who to follow" blocks in the feed.
  • Removed stories in the feed (those between the posts, not those on top of course).
  • Carousel posts always show the first media instead of randomly jumping to the second one.
  • Analytics requests are blocked.
  • Enabled "internal" settings, accessible by either long-pressing the home tab or in the settings menu. These allow doing a lot, so use with care. The most useful feature so far is the ability to manually override each of the gazillion server-side configuration values.

Without further ado, here's the link: Download.

How my patch works
Instagram, as, probably, all the other Facebook apps, uses Proxygen for its HTTP client. Since Proxygen is written in C++, it needs JNI bindings to be used in an Android app. This means that the Java classes that interface with the native code can't be obfuscated. So, instead of digging through piles of obfuscated code that gets reshuffled with each update, I did the most straightforward thing: I injected my code into Proxygen's Java part. I had to make minimal modifications to the bytecode in order to intercept the API responses and pass them through my code before the app gets any chance to process them.

To repeat the process yourself:
  1. Download any Instagram apk or pull one from your device.
  2. Run apktool d on it.
  3. Download Proxygen patch.zip and unpack it. Place the two files into smail/com/facebook/proxygen in your disassembled Instagram folder, replacing the existing ones.
  4. Download Hooks.zip, unpack it and place the folder into any of the smali folders; I did smali_classes3 because there was no room for method references in the first dex.
  5. Build the new apk with apktool b.
  6. Sign it.
  7. Install it.
  8. Enjoy!
The sources for the hooks are in Hooks sources.zip. You compile these with javac, then run dx to convert them to dex, then baksmali to get the smali files that apktool can then integrate into Instagram's dex.

Unlocking the developer settings is another thing entirely as it doesn't depend on the API. There's no getting around the obfuscated code. You need to find an enum class that has RELEASE, DEBUG, INHOUSE as its values. There are several methods that return boolean; you need to change the one that returns true to false (this determines whether this is a release build), and then another one to return true so that the build type returned ends up as INHOUSE. Decompiling it using jadx makes figuring this out a lot easier.

I'll probably automate the patching process at some point in the future.

Hope you enjoy!
The Following 31 Users Say Thank You to Grishka11 For This Useful Post: [ View ] Gift Grishka11 Ad-Free
 
 
3rd May 2019, 08:41 PM |#2  
Member
Thanks Meter: 7
 
More
App seems to crash when I access my following list by going to my profile. Running Android Pie.
The Following 2 Users Say Thank You to Ac3Da3m0n For This Useful Post: [ View ] Gift Ac3Da3m0n Ad-Free
5th May 2019, 08:34 AM |#3  
Ferreira_F10's Avatar
Senior Member
Flag São Paulo
Thanks Meter: 69
 
More
Quote:
Originally Posted by Ac3Da3m0n

App seems to crash when I access my following list by going to my profile. Running Android Pie.

I can confirm this. App crashes when I open my following and followers list, and when I open my "viewed by" stories list.

Enviado de meu Redmi Note 5 usando o Tapatalk
The Following 2 Users Say Thank You to Ferreira_F10 For This Useful Post: [ View ] Gift Ferreira_F10 Ad-Free
8th May 2019, 09:41 AM |#4  
Junior Member
Thanks Meter: 2
 
More
I'll test on my Xiaomi Redmi Note 6 Pro
8th May 2019, 12:17 PM |#5  
el_easy's Avatar
Senior Member
Flag XDA-Forum
Thanks Meter: 94
 
More
Can I download pics with this Mods?
8th May 2019, 05:35 PM |#6  
Member
Thanks Meter: 7
 
More
Quote:
Originally Posted by el_easy

Can I download pics with this Mods?

No. It's not modded Instagram app.
9th May 2019, 08:11 AM |#7  
Junior Member
Thanks Meter: 1
 
More
Crashes on following/followers list
And on multiple logins also
9th May 2019, 02:22 PM |#8  
OP Member
Flag Saint-Petersburg
Thanks Meter: 77
 
More
Quote:
Originally Posted by el_easy

Can I download pics with this Mods?

No. This doesn't touch any of the UI because I aim for it to be as portable between versions as possible. To modify the UI you inevitably have to touch obfuscated code.
The Following 3 Users Say Thank You to Grishka11 For This Useful Post: [ View ] Gift Grishka11 Ad-Free
9th May 2019, 03:17 PM |#9  
OP Member
Flag Saint-Petersburg
Thanks Meter: 77
 
More
These crashes are caused by apktool not decoding resources properly. I created an issue on github.
The Following 2 Users Say Thank You to Grishka11 For This Useful Post: [ View ] Gift Grishka11 Ad-Free
10th May 2019, 01:10 AM |#10  
nicknitewolf's Avatar
Recognized Developer
Flag Singapore
Thanks Meter: 3,095
 
Donate to Me
More
Great work. On the most part, ads are blocked. However, branded content shows up in the feed sometimes. I think there's an internal setting called "branded content show settings" not sure if this is the right option.

Also has anyone figured out which internal flag switches the feed back to a linear post history instead of the personalized one?

Edit:
To those who can't seem to install the apk, you have to disable Play Protect in the Google Play Store as that is blocking apps with an unknown signature from being installed.
10th May 2019, 06:57 AM |#11  
lukekaramazov's Avatar
Member
Thanks Meter: 19
 
More
There are some crashes when I tweaking settings, otherwise good mod.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes