Skip to content

Instantly share code, notes, and snippets.

@drewwells
Last active December 1, 2025 16:24
Show Gist options
  • Select an option

  • Save drewwells/8548b1a5f23abf612d205827be8e5098 to your computer and use it in GitHub Desktop.

Select an option

Save drewwells/8548b1a5f23abf612d205827be8e5098 to your computer and use it in GitHub Desktop.
download brushfire video streams
#!/usr/bin/env bash
set -euo pipefail
# Save cookies for authentication with firefox cookies.txt
# Open a stream and look for a mpd manifest url
# Requires yt-dlp https://github.com/yt-dlp/yt-dlp?tab=readme-ov-file#installation
# yt-dlp https://resi.media/1meRuW/9fed7063-5324-4a77-a95f-78299afaaaaa/Manifest.mpd\?src\=emb --output saturday.mp4 --cookies cookies.txt --video-password 0000 --abort-on-error --format 0
# yt-dlp https://resi.media/4ApwHe/6456b036-0c6c-4d5e-8899-97b6e664aaaa/Manifest.mpd\?src\=emb --output sunday.mp4 --cookies cookies.txt --video-password 0000 --abort-on-error --format 0
usage() {
cat <<EOF
Usage: $0 -p VIDEO_PASSWORD [-c cookies.txt] [-f FORMAT] MAPPING_FILE
Open the Brushfire stream for a specific day and find the mpd url to download
MAPPING_FILE format (one per line, name and URL separated by the first colon):
open_2025_saturday:https://resi.media/....../Manifest.mpd?src=emb
open_2025_sunday:https://resi.media/....../Manifest.mpd?src=emb
This will create:
video_2025_saturday.mp4
video_2025_sunday.mp4
Options:
-p VIDEO_PASSWORD Video password (required)
-c COOKIES_FILE Cookies file (default: cookies.txt)
-f FORMAT yt-dlp format selector (default: 0)
-h Show this help
EOF
}
VIDEO_PASSWORD="00"
COOKIES_FILE="cookies.txt"
FORMAT="0"
while getopts ":p:c:f:h" opt; do
case "$opt" in
p) VIDEO_PASSWORD="$OPTARG" ;;
c) COOKIES_FILE="$OPTARG" ;;
f) FORMAT="$OPTARG" ;;
h)
usage
exit 0
;;
\?)
echo "Error: invalid option -$OPTARG" >&2
usage
exit 1
;;
esac
done
shift $((OPTIND - 1))
if [[ -z "$VIDEO_PASSWORD" ]]; then
echo "Error: video password is required (-p VIDEO_PASSWORD)" >&2
usage
exit 1
fi
if [[ $# -lt 1 ]]; then
echo "Error: MAPPING_FILE is required" >&2
usage
exit 1
fi
MAPPING_FILE="$1"
if [[ ! -f "$MAPPING_FILE" ]]; then
echo "Error: mapping file '$MAPPING_FILE' does not exist" >&2
exit 1
fi
# Check cookies file exists and is non-empty
if [[ ! -s "$COOKIES_FILE" ]]; then
echo "Error: cookies file '$COOKIES_FILE' is missing or empty" >&2
exit 1
fi
while IFS= read -r line || [[ -n "$line" ]]; do
# Strip pure-whitespace lines
if [[ -z "${line//[[:space:]]/}" ]]; then
continue
fi
# Skip comment lines starting with '#'
case "$line" in
\#*) continue ;;
esac
# Split on the FIRST colon: name:url-with-colons
name="${line%%:*}"
url="${line#*:}"
# If there was no colon, name == line
if [[ "$name" == "$line" || -z "$name" || -z "$url" ]]; then
echo "Skipping invalid line in '$MAPPING_FILE': $line" >&2
continue
fi
outfile="${name}.mp4"
echo "Downloading '$name'"
echo " URL: $url"
echo " File: $outfile"
yt-dlp "$url" \
--output "$outfile" \
--cookies "$COOKIES_FILE" \
--video-password "$VIDEO_PASSWORD" \
--abort-on-error \
--format "$FORMAT"
done < "$MAPPING_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment