TubeReplacer
- 18 Devlogs
- 56 Total hours
a youtube fix for youtube versions 1.0.0-2.0.0 for ancient iphones. also kinda basically writing my own youtube library.
a youtube fix for youtube versions 1.0.0-2.0.0 for ancient iphones. also kinda basically writing my own youtube library.
I’ve been doing a lot of work on getting SABR playback working. I think i’ve got sending “preferred” audio & video formats, client info stuff and probably some other things too. Currently the only response I have is sabr.malformed_config (2c1d0a15 73616272 2e6d616c 666f726d 65645f63 6f6e6669 6710021a 022006). Most of these 7h 30m were done on the ground, but i’m working on this at 37 000ft in the air. Had to do some hacks & scripting to get this to connect to the internet, which needs you to watch an ad every 30 minutes.
I did a bunch of integration stuff, and cleanup, but now it plays 360p from the mweb client! I had to add an extra way to decipher n/sig to it (since youtube is yes), but it seems decently reliable, execpt for me not having POToken generation checks to see if it’s ready. Hopefully shouldn’t be too hard :)
iOS 5 now works with the botguard stuff! It was pretty simple, I just had it load the cloudflare version of polyfill.io and copied the JS it gave (since it’s based on UA)
I did some minor optimization of the POToken stuff, so it doesn’t block the main (UI) thread for too long, turning 2478.5ms -> 8.8ms by adding a 0 second settimeout when starting the botguard VM.
I also went to go check on iOS 5. When there, I noticed my analytics temp file was failing to write, meaning it sent a “installed” event every launch. This is well… bad. It means my analytics are bad yay! I added a small check to see if I can actually write this file before sending it off, i’ll diagnose it later.
And finally, I DID IT!!!!!!!!!!!!!!! YESS!!!!! This URL was generated on the phone, from a URL from the mobile client, meaning I can now get signed in videos. This was months and have ruined the speed of startup… BUT IT WORKS!!!!!
I also have to actually make it like use the n/sig function, and do other tweaks since I used a proxy to manually implant the URL. It also means I can finally start making a SABR client inside this. I am very happy 😭
YESSS I HAVE A N/SIG SOLVED WITH JS CHALLENGE. I am yet to test if it’s valid though, here’s hoping lol.
In an effort to keep it on device, I tried switching to tree-sitter. I got it all compiled for iOS, and I did get it to just parse the javascript on device! However, it took 40 seconds to parse. Along with this, RAM usage went from 58MB -> 220MB. The 3GS (one of the current targets) only has 256MB, and if I ever even try on the 3G, that only has 128MBs of ram. This is very bad.
As much as it pains me, I think the best solution would likely be to have a server pick out the n/sig function, and have the device pull a json file or something which has the functions it needs. Kinda does ruin the “no server is involved” stuff with this, but that kinda does seem like the sacrifice I have to make unfortunately. Sadge :(
So I decided to look at n/sig, as that’s what I need next. N/Sig is basically two steps
The n/sig function is located somewhere in https://www.youtube.com/s/player/882a803a/player_es6.vflset/en_US/base.js (the link changes as new players come out, so it’s dynamic). If you look at it for a bit, you may notice it’s quite big. 2.4mb. Every other tool puts it into something called meryiah, a JS parser. https://meriyah.github.io/meriyah/. If you try to put that script into that site, you will notice the output is extremely long. It’s long enough that you cannot select all of it. It’s also long enough to cause memory exhaustion. This is a problem. I cannot run this on my device without causing an out of memory crash. I’m unsure right now how I should get around this, but we will see
I also did some integrating the POToken stuff with the rest of that app, but that was relatively minor execpt for the bad memory management I do biting me in the ass. I think this may have also destroyed launch preformance, but i guess we have to see.
I quickly did coldstart token generation. This is intended for when the POToken engine is starting up/unavailable. It’s used to allow for instant playback on actual youtube, and here too I hope. There’s a few things I need to do to make sure this works alright. Right now, if there’s no network on startup, the engine will just be perpetually broken, and that’s not great, so I need to handle that, along with actually integrating it with the rest of the tweak.
i did it! i now have a POToken on device. God that took far too long lol. Now I actually have to like… use them. im going to bed.
Probably had some other things, but I got the botguard response in the youtube app instead of the YT Capture app. This was shockingly annoying, since idk why, but the GTMHTTPFetcher just… doesn’t work on the youtube app? Since at least for now this is iOS 5+, I just switched to an equivalent function in the NS stuff.
Right now this does botguard responses only, but I need POToken generation, so here I go i guess…..
(isn’t this just riveting?)
I decided that QuickJS was just not working out, and decided to switch over to a hidden webview. I had a few hiccups due to the fact that it’s an ancient webview, and thus missing functions like await, async, and Symbol. The latter was required by the botguard’s iframe, which caused issues trying to polyfill it, but I got there in the end. And now I have a fresh botguard token! Now it’s time for POTokens, and then the needed tokens for uploading videos!
I fixed an issue where videos with a view count over the 32bit integer limit (2.14B) go into the negatives. This was relatively annoying since the issue was the app turning the int64 into an int when passing it to a function to display the video, meaning I had to RE & recreate the functions for displaying video info three times! (1.2.1 & 1.3.0 had different versions for iPad, and 2.0.0)
Also did a small fix to the dislikes where viewing a video where more dislikes than likes (baby shark) would make the likes & dislikes 50/50.
Took a break from PO stuff still, but now you can select a specific channel, though i’ve hidden my other one bcuz privacy.
Since I keep seeing crash reports from people not reading “Known Issues”, i’ve added one for this, and iPad on iOS 9 incompatibilities. Hopefully I will stop seeing all this :)
I am taking a break from POToken for now, since they are legitimately hell, and it’s kinda gotten in a state where too much is broken and I must do a patch to fix these issues. I’ve managed to fix most of the issues which include
I’m getting somewhere but it’s still quite wrong. I managed to “pass” initalization, but generating a botguard response is just flat out broken. This should look very different. I changed out some bits on how setTimeout & setInterval to get it to initalize, but I don’t know if something there is wrong or what is happening :(
Sooo uhh suffering :D I do not know everything in this 2h 26m, but I spent a bunch of time rewriting some of my requesting stuff to have auth for challenges, and debugging why the challenge response I got was junk. Turns out, I’m bad at javascript and didn’t properly await -_-. Now I can actually get a completed challenge! but only currently in the browser… Time to try it on device!