Skip to content

Instantly share code, notes, and snippets.

@9x3l6
Last active August 24, 2023 01:36
Show Gist options
  • Save 9x3l6/8fd6c44b8f95472f0066ad40f5bb3554 to your computer and use it in GitHub Desktop.
Save 9x3l6/8fd6c44b8f95472f0066ad40f5bb3554 to your computer and use it in GitHub Desktop.
YTDL function for downloading videos
function ytdl-update() {
python3 -m pip install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz
}
function ytdl () {
local RETRIES=10 # --retries "${RETRIES}"
local LANG=en,es,de,fr,ru,uk # --sub-lang "${LANG}"
local FORMAT=best # --format "${FORMAT}"
local AGE=21 # --age-limit "${AGE}"
local SLEEP=5 # --sleep-requests "${SLEEP}"
local VID=$1 # ${@}
if [ "$VID" == "" ] && [ -f "./url.txt" ]; then VID="$(cat url.txt)"; fi
export PYTHONHTTPSVERIFY=0; LC_ALL=en_US.UTF-8; yt-dlp --rm-cache-dir --restrict-filenames --download-archive downloaded.txt --retries "${RETRIES}" --write-thumbnail --write-info-json --write-description --geo-bypass --age-limit "${AGE}" --format "${FORMAT}" --no-mark-watched -ciw --write-auto-sub --sub-lang "${LANG}" --sleep-requests "${SLEEP}" "${VID}" 2>&1
}
function ytdl-comments () {
local SLEEP=1 # --sleep-requests "${SLEEP}"
local VID=$1 # ${@}
if [ "$VID" == "" ] && [ -f "./url.txt" ]; then VID="$(cat url.txt)"; fi
export PYTHONHTTPSVERIFY=0; LC_ALL=en_US.UTF-8; yt-dlp --rm-cache-dir --restrict-filenames --no-write-thumbnail --no-write-auto-subs --write-info-json --no-write-description --sleep-requests "${SLEEP}" --write-comments --skip-download "${VID}" 2>&1
}
# create directory where to download all videos from a channel
mkdir nonvaxer420;

# change into the directory
cd nonvaxer420;

# save url of channel for usage later when downloading new videos
echo https://rumble.com/user/nonvaxer420 > url.txt;

# download all videos from url saved in url.txt file
ytdl;

# or this way

# make direcory where to download videos
mkdir themastersvoiceprophecyblog;

# change in to the directory
cd themastersvoiceprophecyblog;

# 
# echo https://www.youtube.com/@themastersvoiceprophecyblog > url.txt;

# use url of specific video or playlist or channel to download all videos
ytdl https://www.youtube.com/@themastersvoiceprophecyblog;
https://www.youtube.com/@themastersvoiceprophecyblog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment