youtube-dl & alternatives
#3
RE: youtube-dl & alternatives
a good opportunity to post this once more:
Code:
#!/bin/bash
# /usr/local/bin/yt2mp3
# A very simple bash script to download a YouTube video
# and extract the music as an mp3 file.
# use as:  yt2mp3 https://www.youtube.com/watch?v=ytvideoid

address=$1
regex='v=(.*)'
    if [[ $address =~ $regex ]]; then
    video_id=${BASH_REMATCH[1]}
    video_id=$(echo $video_id | cut -d'&' -f1)
    #video_title="$(youtube-dl --get-title $address)"
    video_title="$(yt-dlp --get-title $address)"
    #youtube-dl --id $address
    yt-dlp --id $address
    ffmpeg -i "$video_id".* "$video_title".wav
    lame -b 256 -h  "$video_title".wav "$video_title".mp3
    rm "$video_id".* "$video_title".wav

else
    echo "Sorry but the system encountered a problem."
fi
(This post was last modified: 04-20-2022, 12:54 AM by lunatic.)
lunatic
insane in the mainframe

Trade Count: (0)
Posts: 150
Threads: 1
Joined: Apr 2019
Find Reply
04-20-2022, 12:53 AM


Messages In This Thread
youtube-dl & alternatives - by jpstewart - 04-19-2022, 11:41 PM
RE: youtube-dl & alternatives - by Raion - 04-19-2022, 11:45 PM
RE: youtube-dl & alternatives - by lunatic - 04-20-2022, 12:53 AM
RE: youtube-dl & alternatives - by jpstewart - 04-20-2022, 11:26 PM
RE: youtube-dl & alternatives - by lunatic - 04-21-2022, 12:22 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)