A while ago I made a tiny function in my ~/.zshrc to download a video from the link in my clipboard. I use this nearly every day to share videos with people without forcing them to watch it on whatever site I found it. What’s a script/alias that you use a lot?

# Download clipboard to tmp with yt-dlp
tmpv() {
  cd /tmp/ && yt-dlp "$(wl-paste)"
}
  • Flyswat@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    1
    ·
    10 hours ago

    To save videos from certain streaming sites that are not supported by yt-dlp, I catch the M3U playlist used by the page and with that I use this script that gets ffmpeg to put together the pieces into a single file.

    #!/bin/bash
    if [ "$1" == "-h" ] || [ $# -lt 2 ]; then
    	echo Download a video from a playlist into a single file
    	echo usage: $(basename $0) PLAYLIST OUTPUT_VID
    	exit
    fi
    
    nbparts=$(grep ^[^#] $1 | wc -l)
    
    echo -e "\e[38;5;202m Downloading" $(( nbparts - 1 )) "parts \e[00m"
    time ffmpeg -hide_banner -allowed_extensions ALL -protocol_whitelist file,http,https,tcp,tls,crypto -i $1 -codec copy $2