th-ch / youtube-music

YouTube Music Desktop App bundled with custom plugins (and built-in ad blocker / downloader)
https://th-ch.github.io/youtube-music/
MIT License
8.96k stars 510 forks source link

[Bug]: Synced Lyrics don't properly fetch lyrics #2308

Closed Reycko closed 3 months ago

Reycko commented 3 months ago

Preflight Checklist

YouTube Music (Application) Version

3.5.1.0

Checklists

What operating system are you using?

Windows

Operating System Version

Windows 11 Pro 23H2 Build 22631.3958

What CPU architecture are you using?

x64

Last Known Working YouTube Music (Application) version

N/A

Reproduction steps

  1. Enable synced lyrics with adblocker (in player mode) and reload, lyrics fail to fetch
  2. Disable adblocker, lyrics successfully fetch

Expected Behavior

Compatibility with the adblocker.

Actual Behavior

States "No lyrics found for this song." if the adblocker is on.

Enabled plugins

  1. Ad Blocker
  2. Synced Lyrics

Additional Information

Cloned the source code and found the issue is an Illegal Invocation error at line 96 of the fetching script.

LemuelDayrit commented 3 months ago

Mine didnt fetch lyrics even the adblocker is disabled

alexdhg commented 3 months ago

yep, tried with youtube prem & adblock disabled and the lyric fetch i thought it's from my pihole lel

ArjixWasTaken commented 3 months ago

I could reproduce this issue, but the weird thing is that the album name in the network request was set to undefined so an empty list of lyric results was coming in.

A definite fix for this would be to do the fetching on the backend context, so the adblocker cannot interfere.

makisukurisu commented 3 months ago

I'm not sure if it'd be effective to create a separate issue for my problem, or if it's OK to report this here. (I'll do the latter first, but, if you would like me to create a separate Issue on the matter - let me know)

For me, the request and response from LRCLIB (as it's called in the app) provider do come, and go. The response even contains the correct, and timed lyrics, for example on a song used in demo of this feature: https://music.youtube.com/watch?v=K1FlAphL2p8&si=UuyyOUHfeBcxlMPZ

The problem though, is that after fetching a response, the .json call fails for some reason, as shown here: image

Though, disabling Ad Blocker, and restarting the app fixed the issue for me.

Maybe this is related to the Chrome version, or something else, mine is:

[
    "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) YouTubeMusic/3.5.1 Chrome/126.0.6478.185",
    "126.0.6478.185"
]

From the navigator.appVersion.match(/.*Chrome\/([0-9\.]+)/) command in console.

JMVRy commented 3 months ago

Yeah, for some reason I get this bug, where everything should go right, but it somehow doesn't.

I listen to a song that has an entry on LRCLIB. I look at the Network tab and the request returns a valid JSON response with correct information. Everything seems to be good. Then it fails on the let s = await a.json() function call. Looking stuff up, it seems like the error is caused by using .call or .apply on a function without the necessary scope.

I can only think it's caused by one thing:

apply() {
    return Reflect.apply(...arguments).then(i=>a(i))
}

the debugger always seems to break at that Reflect.apply(...arguments) line and give that exception.