Skip to content

Commit

Permalink
[fix] "Something went wrong" error for videos (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkwinter authored Jun 29, 2023
1 parent 72670e9 commit 8526001
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/components/unlocker/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,26 @@ function getUnlockedPlayerResponse(videoId, reason) {
logger.error(err, `Player Unlock Method ${index + 1} failed with exception`);
}

return !Config.VALID_PLAYABILITY_STATUSES.includes(unlockedPlayerResponse?.playabilityStatus?.status);
const isStatusValid = Config.VALID_PLAYABILITY_STATUSES.includes(unlockedPlayerResponse?.playabilityStatus?.status);

/**
* Workaround: https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass/issues/191
*
* YouTube checks if the `trackingParams` in the response matches the decoded `trackingParam` in `responseContext.mainAppWebResponseContext`.
* However, the `TV Embedded Player` does not include the `trackingParam` in the `responseContext`, causing the check to fail.
*
* This workaround addresses the issue by hardcoding the `trackingParams` in the `TV Embedded Player` context.
*/
if (isStatusValid && strategy.name === 'TV Embedded Player') {
unlockedPlayerResponse.trackingParams = 'CAAQu2kiEwjor8uHyOL_AhWOvd4KHavXCKw=';
unlockedPlayerResponse.responseContext = {
mainAppWebResponseContext: {
trackingParam: 'kx_fmPxhoPZRzgL8kzOwANUdQh8ZwHTREkw2UqmBAwpBYrzRgkuMsNLBwOcCE59TDtslLKPQ-SS',
},
};
}

return !isStatusValid;
});

// Cache response to prevent a flood of requests in case youtube processes a blocked response mutiple times.
Expand Down

0 comments on commit 8526001

Please sign in to comment.