Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#!/bin/sh
# This file:
#   http://angg.twu.net/bin/youtube-dl.html
#   http://angg.twu.net/bin/youtube-dl
#           (find-angg "bin/youtube-dl")
# Author: Eduardo Ochs <eduardoochs@gmail.com>
# Version: 2021dec11
# Public domain.
#
# What is this
# ============
# Eev has some tricks for downloading videos using youtube-dl.
# They are explained - with a video! - here:
#
#                        (find-eev "eev-tlinks.el"    "find-youtubedl-links")
#   http://angg.twu.net/eev-current/eev-tlinks.el.html#find-youtubedl-links
#
# In 2021 youtube-dl stopped being developed. It was sort of
# replaced by yt-dlp, that does not support the command-line option
# "-t" of youtube-dl, that I use a lot. See:
#
#   https://news.ycombinator.com/item?id=28289981 Youtube-dl is possibly dead (reddit.com)
#   https://old.reddit.com/r/DataHoarder/comments/p9riey/youtubedl_is_possibly_dead/
#   https://github.com/yt-dlp/yt-dlp
#   https://github.com/yt-dlp/yt-dlp#Removed
#
#                        (find-eev "eev-tlinks.el"    "ee-youtubedl-command")
#   http://angg.twu.net/eev-current/eev-tlinks.el.html#ee-youtubedl-command
#
# Instead of changing the code in eev that uses youtube-dl I thought
# that it would be better to create this script. If you put this
# script in your PATH then it will simulate youtube-dl using yt-dlp,
# in this sense:
#
#               youtube-dl FOO BAR
#   executes:   yt-dlp     FOO BAR
#
#               youtube-dl -t                            FOO BAR
#   executes:   yt-dlp     -o '%(title)s-%(id)s.%(ext)s' FOO BAR
#
# The translation "-t" -> "-o '%(title)s-%(id)s.%(ext)s'" only happens
# when "-t" is the first command-line argument - because 1) this is
# enough for me and 2) because I was too lazy to do something better.
#
# See: (find-es "youtube" "yt-dlp")
#      (find-es "sh" "test")
#      (find-sh "echo $PATH | tr : '\\n'")
#      (find-sh "which yt-dlp")
#      (find-sh "which youtube-dl")

if [ "$1" = "-t" ]; then
  shift
  exec yt-dlp -o "%(title)s-%(id)s.%(ext)s" $*
else
  exec yt-dlp $*
fi

exit



# ----------------------------------------
# Nothing below this point is executed automatically.
# You will need to type `<f8>'s and `M-e's in the right places.

 (eepitch-sh)
 (eepitch-kill)
 (eepitch-sh)

# Install or update yt-dlp.
# From: https://github.com/yt-dlp/yt-dlp#with-pip
#
python3 -m pip install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.zip

# Download this script and make it executable.
# You can replace ~/bin/ by any directory in your PATH.
#
cd ~/bin/
rm -fv    youtube-dl
wget http://angg.twu.net/bin/youtube-dl
chmod 755 youtube-dl
which     youtube-dl

# Test with:
#   (find-youtubedl-links "/tmp/" nil "K6LmZ0A1s9U" nil "punchandjudy")
# There is a video explaining how to use `find-youtubedl-links' here:
#   (find-eev "eev-tlinks.el" "find-youtubedl-links")

# Local Variables:
# coding:  utf-8-unix
# End: