Skip to content

Instantly share code, notes, and snippets.

@jonath92
Last active March 1, 2024 11:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonath92/0f6bf4606bc8a34be1bb0826c99b73d1 to your computer and use it in GitHub Desktop.
Save jonath92/0f6bf4606bc8a34be1bb0826c99b73d1 to your computer and use it in GitHub Desktop.
Install-Update-Youtube-dl Linux Mint
# This is a simple script for install youtube-dl and creating a script in /etc/cron.daily
# to automatically update youtube-dl on a daily basis.
# can be executed with:
# sudo su -c "bash <(wget -qO- https://gist.githubusercontent.com/jonath92/0f6bf4606bc8a34be1bb0826c99b73d1/raw/914aabe6c4b15dc614f18c8816f5ad2828755c22/install-Update-Youtube-dl.sh)" root
# Remove apt version to prevent conflicts
apt purge -y youtube-dl
# Fix python not found error https://askubuntu.com/a/1149489/1013434
ln -s /usr/bin/python3 /usr/local/bin/python
# Install youtube-dl
# https://github.com/ytdl-org/youtube-dl#installation
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
chmod a+rx /usr/local/bin/youtube-dl
# create script for daily update
UPDATE_PATH="/etc/cron.daily/update_youtube_dl"
touch ${UPDATE_PATH}
echo "#! /bin/sh" > ${UPDATE_PATH}
echo "youtube-dl --update" >> ${UPDATE_PATH}
chmod +x ${UPDATE_PATH}
# To uninstall youtube-dl run:
# sudo rm /usr/local/bin/youtube-dl /etc/cron.daily/update_youtube_dl
@jonath92
Copy link
Author

@bamper45 You are right youtube-dl has indeed not been uploaded since month. I will consider switching to the fork you mention in the Radio applet tomorrow but I think there is also a Bug in the applet which is indepent of youtube-dl. Can you tell me which folder you have set in the applet settings for the music download directory?

@jonath92
Copy link
Author

@bamper45 the youtube-dl is not working in the radio applet due to a Bug in Cinnamon when using non UTF-8 characters in folder names. See: linuxmint/cinnamon#10487. I think the download should work when you use a different download folder.

@utilop
Copy link

utilop commented Nov 27, 2021

@jonath92 Yes, I used the downloads folder (name in Russian) maybe because of this. And yes, I also found a folder in my home directory like this "% D1% 82% D0% B0% D0% BA% D0% BE% D0% B3% D0% BE" and it contained 2 tracks (similar to this program )
Now I cannot change and double-check, but then I will write.
Thanks for the answer!

@jonath92
Copy link
Author

@bamper45 You are welcome. Feel free to click the like Button on https://cinnamon-spices.linuxmint.com/applets/view/297 as this helps me to increase my Reputation as a Software developer ;-)

@jimalex71
Copy link

jimalex71 commented Sep 28, 2022

Downloading with youtube-dl works but the log says the file can't be copied from tmp.

Gjs-Message: 15:05:36.113: JS LOG: [LookingGlass/error] Failed to copy download from tmp dir. The following error occurred: Error moving file /tmp/.123AB1/abcdefghi.mp3: No such file or directory

@jonath92
Copy link
Author

What do you mean with "youtube-dl" works? Is the Song in the end downloaded to the directory you selected in the settings? Does the directory you selected in the settings exist? Because this is the only thing I can imagine throwing such Kind of error..

@FoulerTripod
Copy link

FoulerTripod commented Aug 14, 2023

downloading once worked but i got a .webp instead of .mp4 or .mp3 when i tried to update and reload the radio it would give me this error:
JS LOG: [LookingGlass/error] Failed to copy download from tmp dir. The following error occurred: Error: filename couldn't be determined.
And yes the file exists as it is in the download and i tried to create a new file changed the dir and it didnt work

@jonath92
Copy link
Author

Does it happens in some cases or always?

@FoulerTripod
Copy link

it always happened i first suspected it bcs of python i tried to re install everything it would get be the same error would i provide something that will be more useful? I am using Linux Mint

@jonath92
Copy link
Author

yeah no you are right I can reproduce it. This needs to be fixed. As a workaround you can use yt-dlp which you can select in the radio applet settings. and install by sudo su -c "bash <(wget -qO- https://gist.githubusercontent.com/jonath92/039e998b3d3f6ba4afd5d5c671eaedf1/raw/23542a3aadadf5ba181fb8aff723c27610551abd/install-update-yt-dlp.sh)" root

@jimalex71
Copy link

jimalex71 commented Aug 15, 2023

What do you mean with "youtube-dl" works? Is the Song in the end downloaded to the directory you selected in the settings? Does the directory you selected in the settings exist? Because this is the only thing I can imagine throwing such Kind of error..

I mean the MP3 is being created in a temp directory.

It's just not being moved to the destination directory.

Have not fired up the Linux machine in a while but will give it a go again asap.

@FoulerTripod
Copy link

Thank you Jonath92! I love how dedicated you are to the project and I hope one day i can do my own project. Thanks again!

@jonath92
Copy link
Author

You are more than welcome to contribute to the Code. When you have question, I am absolutely willed to help.

@FoulerTripod
Copy link

unfortunately my coding expertise is still minimal at this moment with the only languages i know are java and c++ but if you are interested in translating your applet to Arabic I am proficient in Arabic

@luckyshot
Copy link

For those having problems with youtube-dl, there's already a script to use yt-dlp here:

https://gist.github.com/jonath92/039e998b3d3f6ba4afd5d5c671eaedf1

Then right click Radio++ icon > Configure, go to Preferences tab and choose yt-dlp as the CLI tool.

Make sure the Download directory exists, I had to create the folder Radio or else it would fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment