Bash: Youtube-dl script which adds channel-id to video filenames

UPDATE: 2020-01-15
# A simple 'youtube-dl' one-liner that can replace everything else the script
youtube-dl "$1" -f 'bestvideo+bestaudio' -o "%(channel_id)s---%(id)s---%(title)s.%(ext)s"

Sometime between publishing this script (including subsequent unpublished versions), and now, 'youtube-dl' has added 'channel_id' as a output filename descriptor, therefore making this code largely defunct.

more info: https://github.com/ytdl-org/youtube-dl#output-template

#!/bin/bash
################################################################################
# Download YouTube video, adding 'channel ID' to downloaded video filename¹
# - Arguments: YouTube URL
# source: https://oioiiooixiii.blogspot.com
# version: 2017.11.26.00.04.10
# - Fixed filename issue where youtube-dl uses "mkv" container  
# -------  2017.11.11.15.19.06
# - Changed 'best (mp4)' to best anything (for vp9 4K video) 
# -------  2017.08.05.22.50.15
################################################################################

# Checks if video already exists in folder (checks YouTube ID in filename)
[ -f *"${1##*=}.m"* ] \
   && echo "*** FILE ALREADY EXISTS - ${1##*=} ***" \
   && exit

# Download html source of YouTube video webpage
html="$(wget -qO- "$1")"

# Extract YouTube channel ID from html source
channelID="$(grep channelId <<<"$html" \
            | tr \" \\n \
            | grep -E UC[-_A-Za-z0-9]{21}[AQgw])"

# Download best version of YouTube video
youtube-dl -f 'bestvideo+bestaudio' \
            --add-metadata \
            "$1"

# Download best (MP4) version of YouTube video
#youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' \
#            --add-metadata \
#            "$1"

# Get filename of video created by youtube-dl
filename="$(find . -maxdepth 1 -name "*${1##*=}.m*" \
            | cut -d\/ -f2)"

# Rename filename
echo "Renaming file to: ${channelID}_${filename}"
mv "$filename" "${channelID}_${filename}"

### NOTES ######################################################################

# ¹2017, May 21: Waiting for this to be implemented in youtube-dl
# youtube-dl -v -f137+140 -o '%(channel_id)s-%(title)s-%(id)s.%(ext)s'
# https://github.com/rg3/youtube-dl/issues/9676
download: ytdl.sh
context: https://github.com/rg3/youtube-dl/issues/9676