YoutubeExplode icon indicating copy to clipboard operation
YoutubeExplode copied to clipboard

Age-restricted videos sometimes fail with 403 error

Open Tyrrrz opened this issue 3 years ago • 1 comments

Version

Hash: 1107660

Details

Fetching streams for age-restricted videos, notably SkRSXFQerZs sometimes fails with 403 error. This indicates that the deciphered signature wasn't correct, which in turn means that either something's wrong inside the decipherer logic, signature timestamp extraction logic, or player source resolving logic.

Since this is a transient error that is really hard to reproduce, one will need to insert some debug statements to dump the player source to analyze it and figure out what could be the issue.

Steps to reproduce

Run this test until it fails: https://github.com/Tyrrrz/YoutubeExplode/blob/1107660c9c680de6eee716b650c9135644d76871/YoutubeExplode.Tests/StreamSpecs.cs#L131-L155 (only the AgeRestrictedSignature/SkRSXFQerZs test case)

Tyrrrz avatar Sep 14 '22 18:09 Tyrrrz

AgeRestricted/rXMX4YJ7Lks also fails sometimes with 403 and the response does not return any kind of signature parameter to decipher 🤔

xBaank avatar Sep 15 '22 14:09 xBaank

Thought I fixed it, but no. I was able to sometimes reproduce it locally, and the streams that failed have a signature that ends with multiple = characters. That makes it look suspiciously like a base64-encoded string, but that wasn't the case.

Tyrrrz avatar Jan 28 '23 02:01 Tyrrrz

I've investigated it further and couldn't find any more clues. Also tested out some other downloaders, notably yt-dlp, and they all occasionally fail with 403 too.

Because these errors are relatively rare and quite sporadic, I temporarily "fixed" this by introducing a retry mechanism in https://github.com/Tyrrrz/YoutubeExplode/commit/3937fd423412318579ca96487598486e5b4bcfdf.

Tyrrrz avatar Feb 13 '23 17:02 Tyrrrz