madkarmaa / youtube-downloader

A simple userscript to download YouTube videos in MAX QUALITY
https://greasyfork.org/scripts/479944
45 stars 4 forks source link

Not working, idk? #3

Closed protectedprofile closed 8 months ago

protectedprofile commented 8 months ago

I don't know why it's not working for me anymore, when it used to work. It's possible that something else is interfering with it, I haven't done much testing. I am on linux, using a chrome based browser and see the download button, but I can't download properly. For example, on this random video, I am able to download an mp4, but an about:blank page opens up and there is no possiblity to download an mp3. https://www.youtube.com/watch?v=DKYO94cJzNg. Then, on another link to music https://www.youtube.com/watch?v=prge5lp5hQc I can neither download and mp4 nor a mp3. Then at https://music.youtube.com/watch?v=prge5lp5hQc mostly, I don't have a download arrow, but when I do I can't download anything and have a script error message telling me to wait, but that does nothing. 😥

madkarmaa commented 8 months ago

please open the console of the developer options and paste here screenshots of the output when repeating such operations. I've recently implemented a feature asked in issue #2 , but I've tested it and it works perfectly

if the message telling you to wait is The video data hasn't been loaded yet. Try again in a few seconds... then that means a crucial video player event is not being executed for some reason, which is not the script's fault since it's a native YouTube website event

about the button not appearing, you can try removing this line from the script header

madkarmaa commented 8 months ago

I've added more logs in the commit e9c55df so it should be easier to debug the issue

protectedprofile commented 8 months ago

I have not disabled all other addons, but nothing seems to have changed for me. I don't know why, because I really like this script. Just to show what I have on my system, I have taken (2) screenshots. When I left-click I receive the error message, which is meaningless because the file is loaded and half played and when I right click my right-click menu simply pops up.

Left-Click Right-Click

protectedprofile commented 8 months ago

Two button click (I guess this is middle-click). I don't have a middle-click on my Logitech Trackman Marble Trackball. I am using version 2.0.4, btw.

Middle-Click

protectedprofile commented 8 months ago

I have disabled all other greasyfork scripts ... Sometimes the download arrow does not appear, depending on the link.

https://music.youtube.com/watch?v=QqrNFAadCV8&si=VSAcggQmkwGVJaSs

Left-Click

The video data hasn't been loaded yet Try again in a few seconds...

Right-Click

An error occurred! {"status":"error","text":"it seems like this service is not supported yet or your link is invalid. have you pasted the right link?"}

madkarmaa commented 8 months ago

ok, I found the issue. youtube music doesn't trigger the yt-player-updated event, which is crucial for code placeholders. I'm working on a solution

madkarmaa commented 8 months ago

I have disabled all other greasyfork scripts ... Sometimes the download arrow does not appear, depending on the link.

it sucks, but youtube music is somewhat "malfunctioning", we can say. it only ever uses 1 event, which is called yt-navigate, which, for some reason, doesn't always get fired. since the renderer process starts when the event is fired, then the button won't appear until yt music "chooses" to. I can try to find a solution to that, but fixing the downloads not starting is a priority

madkarmaa commented 8 months ago

as you can see in the following screenshot, the script works, but since the event is not fired, it's not creating the button. then, when yt music "wants" to fire the event, everything works

image

madkarmaa commented 8 months ago

also, I may point out that most youtube music songs are flagged as region restricted by the Cobalt API (used for downloading)

image

madkarmaa commented 8 months ago

try to update and test, @protectedprofile let me know if it works or not

madkarmaa commented 8 months ago

I didn't fix the button not appearing yet, but it should be able to download (if not region blocked)

protectedprofile commented 8 months ago

I updated the script and tried on a random video and it worked, MP4 and MP3. On music.youtube.com it didn't fire. On youtube, where it worked, the download arrow turned red and had an HD on the right side. On music.youtube.com the download arrow was there, but never turned red. It still didn't work, but this time on left click nothing happened, no error but nothing happened. On right click, I had an error. However, I found another link where it did work and the arrow turned red, but did not show HD. https://music.youtube.com/watch?v=8pXLQF7Tdkc&si=x2XFdJxy-ZCmwP9Z Neither file contained any metadata, however. It was named properly, wasn't sure if any metadata should be there?

protectedprofile commented 8 months ago

I don't know if this information could be helpful. I was playing another song by Dio and was finally able to capture my screen showing the download button had turned red, but I was still not able to download on left click and right-click just errored. At the same time the download wasn't functioning, my XDM download manager (using yt-dlp) detected three types of audio I could download.

madkarmaa commented 8 months ago

but this time on left click nothing happened, no error but nothing happened. On right click, I had an error.

yes, because the only way to let a user add their own code, is to use the eval() function which executes js code from a string, which doesn't do any error checking

However, I found another link where it did work and the arrow turned red, but did not show HD.

yes, because that HD badge is present only on YouTube, I just added it as a small addition, it doesn't mean anything

Neither file contained any metadata, however. It was named properly, wasn't sure if any metadata should be there?

it's meant to not have any metadata, it's a setting I set when downloading

madkarmaa commented 8 months ago

my XDM download manager (using yt-dlp) detected three types of audio I could download.

I'm not using yt-dlp, I'm using Cobalt, which has some restrictions. since the issue is fixed BUT you pointed this out, I'll try and see if I can implement yt-dlp instead

madkarmaa commented 8 months ago

nope, yt-dlp is a back-end binary which only works on a machine and not a browser. sorry, this is a userscript and it has some limitations. if you have any other issues/questions feel free to ask