You can try these two commands or modify them to your use (run from your vault root).
I recommend making a backup first or managing the vault with git.
First, download a markdown export of all your notes and extract the zip file. The commands below can be run in that extracted folder.
Download all images off firebase and store them in _attachment/img
.
mkdir -p _attachment/img && \
sed -n 's/.*\[](\(https:\/\/firebasestorage.*\)).*/\1/gp' *.md */*.md \
| sort | uniq \
| sed 's/.*%2F\(.*\)?alt.*/\1\t\0/' \
| awk '{system("wget -O _attachment/img/" $1 " " $2) }'
Then update all the links.
sed -i 's/!\[](https:\/\/firebasestorage.*%2F\(.*\)?alt.*)/![[_attachment\/img\/\1]]/g' *.md */*.md
Note for Mac Users
If you are trying this on a Mac, you will need to install and use gsed/gawk, a GNU userland, and a non-ancient version of bash.
brew install gnu-sed gawk gnutls bash # install gnu userland and non-ancient bash
/usr/local/bin/bash # run modern bash
export PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH
export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH
# now you should be able to run the scripts above