Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These commits fix some of the weird videos I've found that don't work in the current release.
On a branch I didn't push I added tests for them, but I couldn't figure out how to use the tests without putting ONLINE_TESTS in the environment.
Also, one of the tests doesn't work offline, since it actually checks the returned link.
So, I'll just outline the cases here, and you can use those to write tests as you see fit.
The first one, about age restricted videos, was to fix videos "FfM_wS7qYfY" and "pn1VGytzXus".
Both of them list an age restriction in their metadata, but don't present the sign in page. I don't know why, or what that means, but I've seen it.
Testing these videos, from my machine at least, gives a valid url, so the tests pass, but that url results in a 403 if it's fetched.
In order to help my own testing, I added code to make a head request against the url for format 18, and assert that the status code for that was not 403 (Forbidden).
I don't think this would work in offline, mode, though, so I didn't want to commit that test, because I'm not sure if you wanted it.
The second one is about video "PZp3xEdQc38", a video that runs that gamut of failures, ending up in XCDYouTubeVideoOperation's
startNextRequest
method'sself.eventLabels.count == 0
branch.This kicks off a chain that fetches the watch page, which fetches the embed page, which fetches the javascript, which fetches the video_info page.
This leads us to have an unscramble function, since we went through the js at some point, but the video actually doesn't have an "s" parameter or require a signature to be generated.
So, I just took out the part that leads to that being considered an error case, and the rest of the logic seems to work out.
It doesn't appear to ruin any of the other tests.
Hopefully this is useful.