Skip to content

Instantly share code, notes, and snippets.

@franga2000
Created May 27, 2020 23:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save franga2000/a057f5cb84fe3e1185ac4b767ea4b1a5 to your computer and use it in GitHub Desktop.
Save franga2000/a057f5cb84fe3e1185ac4b767ea4b1a5 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# REALLY SHITTY SCRIPT to download BigBlueButton recording
# (this does not record BBB presentations, just archives already recorded ones)
#
# Requires wget, jq (https://stedolan.github.io/jq/) and xq (https://github.com/kislyuk/xq) to be installed.
#
# This script downloads only the resources for a particular presentation without the playback code. That you can get by doing a HAR capture from Firefox and giving it to the command at the bottom of this file.
# This also works if a download is missing some extra features (polls, etc.).
#
wget='wget -nc -x -nH -q --show-progress '
[ -z "$1" ] && echo "You need to provide a link!" && exit 1
meetingId="$(echo $1 | sed 's/.*meetingId=\(.*\)/\1/')"
baseUrl="$(echo $1 | sed 's/\(.*\)\/playback\/.*/\1/')"
echo
echo "Base URL: $baseUrl"
echo "Meeting ID: $meetingId"
echo
read -p "Checks out? (Enter to go, CTRL+C to abort) " -n 1 -r
$wget "${baseUrl}/presentation/${meetingId}/metadata.xml"
meetingTitle="$(xq -r <"presentation/${meetingId}/metadata.xml" .recording.meta.meetingName)"
echo
read -p "Meeting title: " -e -i "${meetingTitle}" meetingTitle
echo
slides="$(xq -r <"presentation/${meetingId}/metadata.xml" '.recording.playback.extensions.preview.images[][]["#text"]')"
files=(
/captions.json
/cursor.xml
/deskshare/deskshare.mp4
/deskshare/deskshare.webm
/deskshare.xml
/panzooms.xml
/presentation/deskshare.png
/presentation_text.json
/shapes.svg
/slides_new.xml
/video/webcams.mp4
/video/webcams.webm
)
for filePath in "${files[@]}"; do
$wget "${baseUrl}/presentation/${meetingId}${filePath}"
done
slides="$slides"$'\n'"$(jq -r 'keys[] as $k | .[$k] as $s | $s | keys[] as $a | "'$baseUrl"/presentation/"$meetingId'/presentation/" + $k + "/" + $a + ".png"' <"presentation/${meetingId}/presentation_text.json")"
echo "$slides" | xargs -n1 $wget
echo "<a href=\"playback/presentation/2.0/playback.html?meetingId=${meetingId}\">${meetingTitle}</a><br>" >> index.html
#
# HAR-based download:
#
# jq -r <"FILENAME_GOES_HERE" .log.entries[].request.url | sort | uniq | grep -v '/playback/' | xargs -n1 wget -nc -x -nH
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment