Browse Source
This script is the very first initial draft and has not been tested very intensely.master
committed by
GitHub
1 changed files with 53 additions and 0 deletions
@ -0,0 +1,53 @@ |
|||||
|
#!/bin/sh |
||||
|
|
||||
|
################################################################# |
||||
|
# This is a script to download music files from youtube # |
||||
|
# # |
||||
|
# Author: Hannes Bohnengel # |
||||
|
# Last modified: 24 July 2016 # |
||||
|
# CLI usage: ./youtube-dl.sh [URL] # |
||||
|
# Required PKGs: youtube-dl, libav-tools # |
||||
|
# # |
||||
|
################################################################# |
||||
|
|
||||
|
## |
||||
|
# -- Settings |
||||
|
## |
||||
|
|
||||
|
# First input argument (URL of youtube) |
||||
|
URL="$1" |
||||
|
|
||||
|
# Create name of output file (for details see youtube-dl --help) |
||||
|
FILENAME="%(title)s.%(ext)s" |
||||
|
|
||||
|
# Extract title of music-file (only to show in CLI) |
||||
|
TITLE=$(youtube-dl --get-title $URL) |
||||
|
|
||||
|
# Setup audio format |
||||
|
AUDIO="mp3" |
||||
|
|
||||
|
# Define command |
||||
|
MYCMD1="youtube-dl -x --audio-format $AUDIO -o ${FILENAME} ${URL}" |
||||
|
|
||||
|
## |
||||
|
# -- End of settings |
||||
|
## |
||||
|
|
||||
|
# Output |
||||
|
echo "================================================================================ |
||||
|
Downloading and transcoding music file from youtube |
||||
|
---------------------------------------------------\n |
||||
|
URL: $URL |
||||
|
Title: $TITLE |
||||
|
================================================================================\n" |
||||
|
|
||||
|
# Execute command NR 1 |
||||
|
echo "$MYCMD1" |
||||
|
|
||||
|
$MYCMD1 |
||||
|
|
||||
|
echo "\n================================================================================ |
||||
|
Finished download |
||||
|
================================================================================" |
||||
|
|
||||
|
|
Loading…
Reference in new issue