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

Search This thread

Grishka11

Member
Jun 30, 2012
39
176
31
Saint-Petersburg
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 View attachment 4752809 and unpack it. Place the two files into smail/com/facebook/proxygen in your disassembled Instagram folder, replacing the existing ones.
  4. Download View attachment 4842971, 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 View attachment 4842969. 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!

13/10/2019: updated to v114 and updated hooks files.
 
Last edited:

nicknitewolf

Recognized Developer
Sep 10, 2013
1,312
3,516
Singapore
Xiaomi Poco F1
Google Pixel 7a
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.
 
Last edited:

el_easy

Senior Member
Jun 17, 2012
431
112
XDA-Forum
Xiaomi Mi 9 SE
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.

Thanks bro, I will wait for the next version because the crashes ...
By the way, I hope one day you can do the same with Facebook app, I know evilwomba does that, but he takes too long to update..:D
 

Grishka11

Member
Jun 30, 2012
39
176
31
Saint-Petersburg
@Grishka11, for many people its crashing including me. Can you upload a patched version so that its easier for everyone to just install the apk?
What do you mean? This is a patched version. There's a bug in apktool that causes it to crash because of the non-standard way the resources are stored in the original apk to reduce its size.

Thanks bro, I will wait for the next version because the crashes ...
By the way, I hope one day you can do the same with Facebook app, I know evilwomba does that, but he takes too long to update..:D
I mainly patched Instagram because I use it myself a lot. Facebook isn't a thing where I'm from, so I don't even have the app installed, I use the mobile website on the rare occasions when I need it. I can try, of course...
 

kancrutt

Senior Member
Nov 9, 2007
1,141
45
JakARTa
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.

confirmed about sponsored post shows up sometimes.
keep up the good work!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 108
    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 View attachment 4752809 and unpack it. Place the two files into smail/com/facebook/proxygen in your disassembled Instagram folder, replacing the existing ones.
    4. Download View attachment 4842971, 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 View attachment 4842969. 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!

    13/10/2019: updated to v114 and updated hooks files.
    26
    V123 arm64 patched with no follower list crash.
    https://www.androidfilehost.com/?fid=4349826312261680102

    If you do a clean install, you will see sponsored posts in the home feed when you first log in. Just force stop the app and the sponsored posts should disappear.
    21
    V120 arm64 patched with no follower list crash.
    https://www.androidfilehost.com/?fid=4349826312261642003

    If you do a clean install, you will see sponsored posts in the home feed when you first log in. Just force stop the app and the sponsored posts should disappear.

    I have also noticed sponsored posts appearing in the explore section. I'm not sure if OP's patches get rid of sponsored posts there, so just live with it.