ok, how about this? :
Bash:
alias vldl='read -p "Enter url : " url && read -p "Enter title: " title && echo -e "${date +"%a %e/%m/%Y"} - ${title} :\n${url}\n" >> "${home}/vldl-history" && cd "${HOME}/Downloads"; yt-dlp --ffmpeg-location /usr/bin "${url}"'
That will prompt you for a URL and a Title (or you could put a short, single line description), It will write the date, description and URL to the history file, before changing directory to your downloads file and will attempt to download the video.
NOTE: In the above, I've made a few notable changes to your alias.
1. To get user input - I've used the
read
command's
-p
switch, which allows you to specify a prompt to use before reading input from the user. That way, we don't need to use
echo
and
read
like this:
Bash:
echo "prompt text here : " && read variableName
Instead, it looks more like this:
Bash:
read -p "prompt text here : " variableName
Where
"prompt text here : "
is the prompt you want to use. And
variableName
is the name of the variable you want to store the user input in.
2. In the date command, I've specified a date format.
In this case,
%a
is the short day name (e.g. Sun instead of Sunday) and then
%e/%m/%Y
is the date in
dd/mm/yyyy format.
So your log-file entries should look something like this:
Code:
Fri 17/11/2023 - Funny cat compilation
https://www.youtube.com/someVideoLinK
Fri 17/11/2023 - Badgers with guns
https://www.youtube.com/NotARealURL
NOTE: The URLS above are NOT valid URLS - it was just a contrived example, to show you what the log output from the command I've given SHOULD yield.
I say SHOULD because I haven't actually tested the alias As long as I haven't made any silly typos it should work. I'm 99.99% sure it will work flawlessly. Ha ha!
This thread has actually given me some interesting ideas for a script which could allow you to download a list of videos in a single batch. Logging download information to a history file..
And to speed up batch downloads, it could use GNU parallel to download multiple videos at once. Hmmmm..... I might get started on that after work this evening, whilst my partner is out at Wells carnival with her grandson.