• gandalf_der_12te
    link
    fedilink
    arrow-up
    6
    ·
    1 天前

    no ads on my side either.

    greetings from the ~/.bin/yt gang.

    use like yt fHYNyCi2lnA where fHYNyCi2lnA is the youtube video id.

    #!/usr/bin/bash
    
    # usage example: yt fHYNyCi2lnA
    if [ "$1" = "" ]; then
    	echo "Usage examples:"
    	echo "   yt fHYNyCi2lnA"
    	echo "   yt https://inv.nadeko.net/watch?v=a1oxZ6RtpPk"
    	exit
    fi
    
    ADDRESS="$1"
    
    # change https://inv.nadeko.net/watch?v=a1oxZ6RtpPk to a1oxZ6RtpPk
    
    if [[ "$ADDRESS" == *"watch"* ]]; then
    	arr=(${ADDRESS//'v='/ })
    	ADDRESS="${arr[1]}"
    fi
    
    
    echo video id: "$ADDRESS"
    
    mpv  "https://youtube.com/watch?v=%24ADDRESS"