In MSEdge, open the devtools console and type "importer(video_id)". Replace video_id by your video id. All streams links will appears under the iframe. You must have CORS unblocked. For this download CORS unblock extension at this link :
https://microsoftedge.microsoft.com/addons/detail/cors-unblock/hkjklmhkbkdhlgnnfbbcihcajofmjgbh
In fact when you fetch your youtube adress with the console opened, www.youtube.com is redirected to m.youtube.com, the android application. You can access m.youtube.com other ways. Then click on the link of your choice to display it in the iframe, or copy the link and paste it in your browser address bar to access it in a new tab. These are not real links, just div with textContent.
This is the code I have writen.
<!DOCTYPE html>
<html>
<head>
<style>
body{background:black;}
</style>
</head>
<body>
<input type="button" style="background:black;border:gray solid 4px;border-style:outset;color:green;" onmousedown="importer(document.querySelector('#inp001').value)" value="Importer"/><input id="inp001" style="background:black;color:green;" value="V9PVRfjEBTI"/><br>
<iframe style="height:100%;width:100%;" src="https://www.youtube.com"></iframe>
<script>
async function importer(christ){const r = await fetch(`https://m.youtube.com/watch?v=${christ}`);
const t = await r.text();
const index1 = t.indexOf("jsUrl")+8;
const sub1 = t.substring(index1);
const index2 = sub1.indexOf('"');
const sub2 = sub1.substring(0,index2);
const base = `https://m.youtube.com${sub2}`;
const r2 = await fetch(base);
const t2 = await r2.text();
const index3 = t2.indexOf('a.split("");');
const sub3 = t2.substring(0,index3);
const index4 = sub3.lastIndexOf("function")-4;
const variable1 = sub3.substring(index4,index4+3);
const variable2 = t2.substring(index3+12,index3+12+2);
const index5 = t2.indexOf("var b=a.split(a");
const sub4 = t2.substring(0,index5);
const index6 = sub4.lastIndexOf("function")-4;
const variable3 = sub4.substring(index6,index6+3);
console.log(variable1,variable2,variable3);
const scr = document.createElement("script");
scr.textContent = t2.replace("})(_yt_player);",`window['var1']=eval(${variable3});window['var2']=eval(${variable1});window['var3']=eval(${variable2});})(_yt_player);`);
document.body.insertBefore(scr,document.querySelector("script"));
const doc = document.implementation.createHTMLDocument();
doc.write(t);
console.log(doc);
const arr = doc.querySelectorAll("script");
const scr2 = Array.from(arr).filter((x)=>{if(x.textContent.match("ytInitialPlayerResponse")!==null){return x}});
const scr3 = document.createElement("script");
scr3.textContent = scr2[1].textContent;
document.body.insertBefore(scr3,document.querySelectorAll("script")[1]);
const adapt = ytInitialPlayerResponse.streamingData.adaptiveFormats;
const arr2 = Array.from(adapt);
arr2.forEach((item,index)=>{
const sign = item.signatureCipher;
const para = new URLSearchParams(sign);
const s = para.get("s");
const nsig = window['var2'](s);
const url = para.get("url");
const url2 = new URL(url);
const n = url2.searchParams.get("n");
const n2 = window['var1'](n);
url2.searchParams.set("n",n2);
url2.searchParams.set("sig",nsig);
const div = document.createElement("div");
div.textContent = url2.href;
div.style.color = "green";
div.style.cursor = "grab";
console.log(url2.href);
div.addEventListener("mousedown",function(event){document.querySelector("iframe").src=event.currentTarget.textContent;event.currentTarget.style.color="blue";});
document.body.insertBefore(div,document.querySelector("script"));
const div2 = document.createElement("div");
div2.innerText = "\n\n";
div.after(div2);
});
};
</script>
</body>
</html>
This is a working infinityfreeapp.com example. Don't forget to open your Devtools console in MsEdge or Google Chrome. This is my own site so there is not subscription, ads, or pop-up.
http://leseditionslyriques.infinityfreeapp.com/Youtuber.html
Well, I have decipherised the signatureCipher in pure Javascript.
To muxing the audio and video streams, I recommend ffmpeg fun tab extension, for example, to do all the work online without desktop application. You can find it here :
https://chromewebstore.google.com/detail/ffmpeg-fun-tab/jknbmdhgmkaegnckekoibhlabacgafab
Or simply use ffmpeg.exe.