UnblockNeteaseMusic / server

Revive unavailable songs for Netease Cloud Music (Refactored & Enhanced version)
GNU Lesser General Public License v3.0
6.29k stars 630 forks source link

Music getting replaced by ads (probably from bilibili) #1347

Closed theandychung closed 1 month ago

theandychung commented 8 months ago

Bug 描述

Music getting replaced by an advertisement probably from bilibili based on the source I see in command window (bilivideo.com), even though the youtube srouce is better and should not have ads. image

预期行为

Check from database to make sure the song has the right length, and play the song from Youtube since it is more accurate.

实际行为

Playing song from bilibili, which should be discard since it doesn't even have the right length (only 1 min 47 sec).

复现步骤

Play "Roar" by "Katy Perry" and use the default sources and default priority.

启动命令及环境变量

  1. download this repo to windows 10, install Note.js, ping 163's url to find its ip (which is 103.126.92.133), then change the host file.
  2. Run the following command: node app.js -p 80 -f 103.126.92.133

日志内容

app.log

网易云音乐歌曲链接

https://music.163.com/#/song?id=27566922

网易云音乐版本号

HyPlayer

操作系统

Windows 10

其他信息

I'm currently trying to use it in HyPlayer, which is set to use http instead of https. However, I think this is a "checking source before use" issue, nothing to do with HyPlayer. It's understandable if you guys don't support HyPlayer nor http. Please close this issue if that's the case. Thanks

Edit: Another thing I noticed is that according to yt-dlp, they now support bilibili search:

Merged with animelover1984/youtube-dl: You get most of the features and improvements from animelover1984/youtube-dl including --write-comments, BiliBiliSearch, BilibiliChannel, Embedding thumbnail in mp4/ogg/opus, playlist infojson etc. Note that NicoNico livestreams are not available. See https://github.com/yt-dlp/yt-dlp/pull/31 for details.

So you might be able to just delete the bilibili search from this repo.

问题排查

1715173329 commented 8 months ago

Check from database to make sure the song has the right length, and play the song from Youtube since it is more accurate.

https://github.com/UnblockNeteaseMusic/server/blob/7354cc59421f7c4ca785688367df50669edb0002/src/provider/select.js#L3-L10

we do, but not all providers have duration implemented, in this case, we just take the URL from the 1st response

theandychung commented 8 months ago

Alright, I finally can enter debug mode today. (I'm not sure how to set the environment variable properly using your code to enter the debug mode, so I use set LOG_LEVEL=debug in command line to set it.) The result is quite interesting. Here is the log: app.log

In the log, I noticed that the program did find the right song using yt-dlp, but it was after the selection was made. My assumption is that since I do not live in China, all my requests to Chinese website sources were instantly denied, so all of them filled up the list and became the fastest 5 sources. If this is true, I suggest the program to check the sources are valid before using. If those sources are not valid, just remove them from any future search even if the user put them into their priority list. The program will re-evaluate those sources only if the user restarted the program.

Another thing, I feel that "duration" return from each sources is kind of suspicious. The log file shows that all of the "duration" from different sources are exactly the same (223608 in this case), but all of those sources should have denied me from downloading anything, which makes me think that it might be just the duration of the song from their database, not the song duration we will actually get from the server. If that's true, I think the program might have to check if the file size or duration we will get is the same as what we expected.

Sorry, I know how to code in many programming languages, but I don't have any experience in coding note.js. I've already tried but failed to run and debug this code in vscode for few days now, and all I can get right now is to run app.js using vscode. Not sure how to run launch.js to debug it with a known song id. If you could give me some hints I might be able to dig a little bit more.

Thanks.

1715173329 commented 1 month ago

Thinking you can just manually specify music sources and remove bilibili.