Created
March 14, 2024 16:04
-
-
Save LuchoLopez/99e1856e99fb3486588f89da69dfc0fa to your computer and use it in GitHub Desktop.
Download MP3 music from YT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Please, make sure you have: python3, pytube and ffmpeg before running this script | |
DOWNLOAD_DIR="./downloads" | |
mkdir -p "${DOWNLOAD_DIR}" | |
pytube3 -a mp4 -t "${DOWNLOAD_DIR}" "${1}" | |
pushd "${DOWNLOAD_DIR}" | |
find . -type f -iname '*.mp4' -exec sh -c 'ffmpeg -i "$1" "${1%.*}.mp3"' sh {} \; | |
find . -type f -iname '*.mp4' -exec rm {} \+ | |
popd | |
ls "${DOWNLOAD_DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
Single video:
Playlists:
NOTE: Please, note that I made some changes to the original link (
https://www.youtube.com/watch?v=kXYiU_JCYtU&list=PL6Lt9p1lIRZ311J9ZHuzkR5A3xesae2pk
). Replacewatch?
withplaylist?
and remove thev=...&
parameter