Greg Neagle created a Python script titled installinstallmacos.py that downloads macOS installer applications
from Apple’s servers.
There is a fork by Graham Pugh that adds the ability to search for a matching
release using a version string like 10.15.7
:
https://github.com/grahampugh/macadmin-scripts/blob/main/installinstallmacos.py
The following command will download the necessary package from Apple’s servers and install the macOS Installer application onto a disk