Skip to content

Commit

Permalink
fix(downloader): fix playabilityStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
JellyBrick committed Aug 4, 2024
1 parent 59a5679 commit 32a572b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plugins/downloader/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ async function downloadSongUnsafe(

let playabilityStatus = info.playability_status;
let bypassedResult = null;
if (playabilityStatus.status === 'LOGIN_REQUIRED') {
if (playabilityStatus?.status === 'LOGIN_REQUIRED') {
// Try to bypass the age restriction
bypassedResult = await getAndroidTvInfo(id);
playabilityStatus = bypassedResult.playability_status;

if (playabilityStatus.status === 'LOGIN_REQUIRED') {
if (playabilityStatus?.status === 'LOGIN_REQUIRED') {
throw new Error(
`[${playabilityStatus.status}] ${playabilityStatus.reason}`,
);
Expand All @@ -275,7 +275,7 @@ async function downloadSongUnsafe(
info = bypassedResult;
}

if (playabilityStatus.status === 'UNPLAYABLE') {
if (playabilityStatus?.status === 'UNPLAYABLE') {
const errorScreen =
playabilityStatus.error_screen as PlayerErrorMessage | null;
throw new Error(
Expand Down

0 comments on commit 32a572b

Please sign in to comment.