shownotes-w3m-rice/youtube_dl_1click_mp3_download.sh

48 lines
1.5 KiB
Bash
Raw Normal View History

2015-10-30 18:46:47 +00:00
#!/bin/bash
# _ _ _ _
# __ _ ___ | |_| |__ | | ___| |_ _ _
# / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
#| (_| | (_) | |_| |_) | | __/ |_| |_| |
# \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
# |___/
# http://www.youtube.com/user/gotbletu
# https://twitter.com/gotbletu
# https://plus.google.com/+gotbletu
# https://github.com/gotbletu
2019-05-08 21:15:47 +00:00
# gotbletu@gmail.com
2015-10-30 18:46:47 +00:00
# tutorial video: https://www.youtube.com/watch?v=nGSGlc9bTAg
2018-05-30 18:15:43 +00:00
# mirror video: https://archive.org/details/youtube_UCkf4VIqu3Acnfzuk3kRIFwA
2015-10-30 18:46:47 +00:00
# a script to copy link and convert youtube videos to mp3
# just create a shortcut launcher on the panel and click on it while on the youtube page you want to download the mp3 from
2015-10-31 13:52:56 +00:00
# requires: ffmpeg wmctrl xclip xdotool youtube-dl
2015-10-30 18:46:47 +00:00
# browser to focus; show list using wmctrl -l
BROWSER_FOCUS=Chromium
# set / create save location
DOWNLOAD_DIR_MP3=~/Downloads/youtube_music
# image to use
IMAGE_LOGO=~/.logo/youtube.png
# focus browser on top
wmctrl -a "$BROWSER_FOCUS"
# copy link to clipboard
sleep 0.5
xdotool key ctrl+l
sleep 0.5
xdotool key ctrl+c
mkdir -p "$DOWNLOAD_DIR_MP3"
cd "$DOWNLOAD_DIR_MP3"
notify-send -i "$IMAGE_LOGO" 'Downloading to MP3' 'Starting ...' -t 5000
2015-11-02 22:10:54 +00:00
# download audio only saves bandwidth (prevents downloading all playlist)
youtube-dl -c --restrict-filenames --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" -f 171 "$(xclip -selection clipboard -o | cut -d\& -f1)"
2015-10-30 18:46:47 +00:00
notify-send -i "$IMAGE_LOGO" 'Downloading to MP3' 'Completed !!!' -t 5000