Open WaqasIbrahim opened 3 years ago
I published an innertube library two days ago. The biggest issues I found was that innertube would happily deliver ciphered streams that would not play (403) when deciphered (solved when your post request includes a valid playback context with the correct signature timestamp from the player). Also when making a logged-in request (bypassing age-restriction), you need to supply a SAPISIDHASH, which is another obfuscated function from the yt player. So it is tricky to depend only on the innertube, unless you are emulating exactly what is happening in the browser.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
In the getInfo pipeline only the html watch page seems to be working at present. The json watch page request is ignored by YT and the get_video_info call returns 410 errors. Inevitably, a move to the innerube api is needed. For these reasons this issue should not become stale.
I published an innertube library two days ago. The biggest issues I found was that innertube would happily deliver ciphered streams that would not play (403) when deciphered (solved when your post request includes a valid playback context with the correct signature timestamp from the player). Also when making a logged-in request (bypassing age-restriction), you need to supply a SAPISIDHASH, which is another obfuscated function from the yt player. So it is tricky to depend only on the innertube, unless you are emulating exactly what is happening in the browser.
YouTube updated their bin player base.js file then i included the correct signature timestamp from that file and passed it below the body context key via json but still got 403 error when trying to play the video url. You also talked about SAPISIDHASH, how do I pass it to the POST request?
I published an innertube library two days ago. The biggest issues I found was that innertube would happily deliver ciphered streams that would not play (403) when deciphered (solved when your post request includes a valid playback context with the correct signature timestamp from the player). Also when making a logged-in request (bypassing age-restriction), you need to supply a SAPISIDHASH, which is another obfuscated function from the yt player. So it is tricky to depend only on the innertube, unless you are emulating exactly what is happening in the browser.
YouTube updated their bin player base.js file then i included the correct signature timestamp from that file and passed it below the body context key via json but still got 403 error when trying to play the video url. You also talked about SAPISIDHASH, how do I pass it to the POST request?
It is passed to the POST request by including it in the headers as the authorization property. So, from https://github.com/gatecrasher777/ytcog/blob/main/lib/video.js on line 362
if (this.session.loggedIn) hdrs.authorization = this.session.player.idhashFn(this.sapisid);
As it suggests, this is required for innertube requests when you are "logged-in", i.e. have supplied a valid session cookie.
YouTube is slowly migrating to their new innertube API and we should consider using the new API for consitent and reliable results. youtube-dl is already using this new API.
Examples:
An age restricted video that does not work with get_video_info route.
The API key and client version can be extracted from watch or embed page.