iOS with Youtube adVanced

Hi. This is a small post to list down the steps involved in getting YouTube Freemium working for your iOS device. It involves using AltStore, AltServer, netmuxd, usbmuxd, and a few scripts that make it easy to automate the whole process along with a small systemctl unit to automatically keep the whole thing running.

Apple does not like people sideloading apps (installing a .ipa app package) on their iPhones or iPads.. but AltServer + AltStore let you sideload up to 3 apps (including the AltStore itself). This does NOT require your phone to be jailbroken. AltStore only works in your LAN, not even through a VPN.

Taking a step back to explain what’s AltServer- it’s a “server” which runs on Linux/Windows/Macbook (referred to as computer from now on) and it connects to the AltStore app which can be installed by connecting your iDevice to your computer through USB and then right-clicking the AltServer icon and going into “Install AltStore” option as shown below.

NOTE: AltServer requires a bunch of deps depending on your OS – on Linux it requires imobiledevice things and on Windows it requires iTunes and iCloud.

Once you install AltStore on your iDevice, open it and go to Settings > Sign In. It will now ask for your Apple ID and password, but on your iDevice this time. Make sure you provide the same credentials as you provided on your computer.

Once you’re done, try Refreshing AltStore in the “Apps” page of AltStore. If AltStore does not show any error, AltStore was successfully refreshed. Once you’re able to successfully refresh AltStore, visit this URL from your iDevice: https://github.com/qnblackcat/uYouPlus#download . Click on the link that says “Open in AltStore” as shown below:-

As it says in the screenshot above, the loading will take time because AltStore will download the IPA app package first. So, ensure that your device does not go to sleep at this point. Once AltStore has downloaded the IPA, you will get this prompt:-

You don’t need to worry about the 10 App IDs per week thing here. Just choose “Keep App Extensions” and don’t switch the app or let the device sleep until you see YouTube in the list along with AltStore. If the installation fails, try again. It works fine on the first try unless the device went to sleep or the app got thrown into the background. Once done, YouTube will be installed on your iDevice with 0 ads, community-powered Sponsorblock and even a Dislike button!

Refreshing?

The downside of AltStore, however, is that unless you have a paid developer account, apps sideloaded using AltStore will only work up to seven days. For paid dev accounts the limit is upped to 365 days. To counter this, AltStore enables users to “Refresh” the sideloaded apps by connecting it to the PC where AltServer would be running. Now, once you have AltStore installed on your iDevice and AltServer running on your PC, you can enable the “Sync with this iDevice over WiFi”. Since AltServer also uses the same connection that iTunes will create with your iDevice, this option will allow you to refresh the sideloaded apps without connecting your device with your PC every few days.

Clunkyness

As you would have noticed, this setup requires your computer to be ON whenever you plan on refreshing your apps. While you can set up an Automation in the Shortcuts app on your iDevice to “Refresh my apps” when, for eg, your battery is charged up to 100%.. I have a very erratic schedule and I sometimes don’t use my computer for a whole week. So, I had to find an alternative.

The Solution: AltServer-Linux

As I mentioned previously, AltServer can be hosted on a Linux system as well. Fortunately, the community provides builds for all mainstream architectures, so you can set up the AltServer on any Linux machine – even a Raspberry Pi! And that’s what I did- by setting up the AltServer on my RPi, I can refresh my apps every day with 0 failures because RPi is always running.

The How

First, I set up imobiledevice things on my Server so I could connect my iDevice and get some meaningful connection with the server. Installing usbmuxd is a part of the process. Once that was done, I paired my device using usbmuxd – that means I ran usbmuxd as root and then connected my iDevice. The iDevice asked for confirmation of whether it should “Trust” this computer. After that, to confirm that my device has been indeed connected, I ran sudo idevice_id --list and it indeed returned me the UDID of my iDevice, so all set now!

Next up, I left usbmuxd running in the background and I grabbed AltServer for Linux from https://github.com/NyaMisty/AltServer-Linux and ran it. Once I started it, I tested it by Refreshing AltStore on my iDevice. Since this is Linux on a Raspberry Pi, the feedback from the AltServer is terminal based but promising!

At this point, I was able to Refresh my apps while having my iDevice connected to the RPi over USB. The next and final step for the proof-of-concept was to achieve Refreshing over WiFi. For this, I grabbed netmuxd which is exactly like usbmuxd but for over-the-WiFi communication. To work, netmuxd requires that you already enabled “Sync This iDevice over WiFi” as described above (you only need to do this once using your computer). Once I downloaded the latest release of netmuxd, I killed the usbmuxd process and started netmuxd instead. Again, I tried refreshing and it worked!

Automate It!

My server is a set-it-and-forget-it kind of a thing. It works autonomously and I automate anything and everything that I deploy on my server. For AltServer on Linux, I found a nifty little script that can handle invoking AltServer and netmuxd and also provides provisions to quickly update both of them with little-to-no hassle: https://github.com/powenn/AltServer-Linux-ShellScript

This enabled me to just trigger ./run.sh and have the system running in the background so I can trigger Refresh from my iDevice at any time within my home network.

To wrap this up, I wrote a small systemctl unit file that triggers run.sh in a GNU/screen environment. Writing a systemctl unit enabled me to register the complete system as a systemctl unit, with support of all the bells and whistles of systemd – one command start, stop, status, restart, logs etc. And GNU/screen is a good way of triggering background processes so I can take a look into the logs and interact with the process anytime.

The final look of the systemctl unit is this:-

And here is the underlying systemctl unit file:-

And finally, I have a server with working AltServer that I use to refresh my sideloaded apps at every 100% charge!

Apple is a very restrictive company, and I love it when people come together to solve problems and figure out the most innovative solutions possible. I thank everyone involved in the development of imobiledevice, usbmuxd, netmuxd, AltStore and AltServer. None of this would have been possible without the support of our empowering community.