youtube add cookies and yt2mp3 scrript
This commit is contained in:
1 parent
5e3a289f4e
commit
61c3d2f6c2
2 files changed
+42
-2
No files matched your search
+2
-2
@@ -85,7 +85,7 @@ if [ ! -f ${youtubelist} ] ; then
|
||||
echo "No youtubelist present"
|
||||
fi
|
||||
if [[ "$(hostname)" == "serverhost" ]] && [[ "${DISABLE_SERVERMODE}" == "false" ]]; then
|
||||
duser_cmd="sudo /home/lucas/scripts/serverhost/deluge_user_cmd.sh"
|
||||
duser_cmd="sudo bash /home/lucas/scripts/serverhost/deluge_user_cmd.sh"
|
||||
duser_cmd=""
|
||||
DL_PATH="/torrent/youtube/"
|
||||
echo "Serverhost mode - VPN"
|
||||
@@ -140,7 +140,7 @@ for VID in $(cat ${youtubelist}); do
|
||||
write_log "Download Music File"
|
||||
${duser_cmd} yt-dlp ${RETRIES} "${line}" -f bestaudio -x --audio-format mp3 --audio-quality 320k --embed-thumbnail --add-metadata --postprocessor-args "-id3v2_version 3" --output "${DL_PATH}%(uploader)s/%(playlist)s_${pl_name}/%(title)s.%(ext)s"
|
||||
else
|
||||
${duser_cmd} yt-dlp ${RETRIES} -w -i "${line}" "${vid_options}" --output "${DL_PATH}%(uploader)s/%(playlist)s_${pl_name}/%(upload_date)s_%(title)s.%(ext)s" --merge-output-format mp4 --remux-video mp4
|
||||
${duser_cmd} yt-dlp --cookies-from-browser chrome ${RETRIES} -w -i "${line}" "${vid_options}" --output "${DL_PATH}%(uploader)s/%(playlist)s_${pl_name}/%(upload_date)s_%(title)s.%(ext)s" --merge-output-format mp4 --remux-video mp4
|
||||
fi
|
||||
ret=$?
|
||||
if [ ${ret} -eq 0 ]; then
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# Usage:
|
||||
# ./download_mp3s.sh links.txt [output_dir]
|
||||
#
|
||||
# links.txt: text file containing one URL per line
|
||||
# output_dir: optional destination directory (default: ./downloads)
|
||||
|
||||
LINKS_FILE="${1:-links.txt}"
|
||||
OUTDIR="${2:-downloads}"
|
||||
|
||||
if ! command -v yt-dlp >/dev/null 2>&1; then
|
||||
echo "Error: yt-dlp not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v ffmpeg >/dev/null 2>&1; then
|
||||
echo "Error: ffmpeg not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
yt-dlp \
|
||||
--newline \
|
||||
--ignore-errors \
|
||||
--extract-audio \
|
||||
--audio-format mp3 \
|
||||
--audio-quality 0 \
|
||||
--embed-metadata \
|
||||
--embed-thumbnail \
|
||||
--add-metadata \
|
||||
--parse-metadata "%(artist|)s:%(meta_artist)s" \
|
||||
--convert-thumbnails jpg \
|
||||
--output "$OUTDIR/%(uploader)s - %(title)s.%(ext)s" \
|
||||
-a "$LINKS_FILE"
|
||||
|
||||
echo "Done."
|
||||
|
||||
Reference in new issue
Block a user