2022-02-11 06:58:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# . CONFIG.sh
|
|
|
|
|
|
|
|
# set -o xtrace ## To debug scripts
|
|
|
|
# set -o errexit ## To exit on error
|
|
|
|
# set -o errunset ## To exit if a variable is referenced but not set
|
|
|
|
|
|
|
|
|
|
|
|
function main() {
|
2025-05-02 21:11:08 +00:00
|
|
|
_STARGET="${1}"
|
|
|
|
_SPATH="${HOME}/.config/solarfm/plugins/youtube_download"
|
2022-02-11 06:58:49 +00:00
|
|
|
LINK=`xclip -selection clipboard -o`
|
2022-12-03 02:00:26 +00:00
|
|
|
|
2025-05-02 21:11:08 +00:00
|
|
|
cd "${_SPATH}"
|
|
|
|
echo "Working Dir: " $(pwd)
|
|
|
|
|
|
|
|
rm "${_SPATH}/../../cookies.txt"
|
|
|
|
|
|
|
|
# Note: Export cookies to file
|
|
|
|
python "${_SPATH}/yt_dlp/__main__.py" \
|
|
|
|
--cookies-from-browser firefox --cookies "${_SPATH}/../../cookies.txt"
|
|
|
|
|
|
|
|
# Note: Use cookies from browser directly
|
|
|
|
# python "${_SPATH}/yt_dlp/__main__.py" \
|
|
|
|
# --cookies-from-browser firefox --write-sub --embed-sub --sub-langs en \
|
|
|
|
# -o "${_STARGET}/%(title)s.%(ext)s" "${LINK}"
|
|
|
|
|
|
|
|
# Note: Download video
|
|
|
|
python "${_SPATH}/yt_dlp/__main__.py" \
|
|
|
|
-f "bestvideo[height<=1080][ext=mp4][vcodec^=avc]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
|
|
|
|
--cookies "${_SPATH}/../../cookies.txt" --write-sub --embed-sub --sub-langs en \
|
|
|
|
-o "${_STARGET}/%(title)s.%(ext)s" "${LINK}"
|
|
|
|
|
2022-02-11 06:58:49 +00:00
|
|
|
}
|
2025-05-02 21:11:08 +00:00
|
|
|
main "$@";
|