Posted August 21, 2025
There is not any way for checking the file integrity?
=== EDIT ===
Already bored of manually downloading and checking (I have too many files to download and check).
If anyone is interested, I wrote a shell script to automate things (I'm sure there is a much better way to write what the script does; please don't scold me, I use to program in C, not in Bash).
In the 'Extras' section there is much content lacking a .xml file, I added a check to know if wget was able to retrieve the corresponding .xml.
As there are no tags for indicating source code, I will use ASCII indicators:
=== SCRIPT START ===
#!/bin/bash
#sintaxis comprobamos número de argumentos
if [ "$#" -ne 2 ]
then
echo ""
echo "Sintaxis: $0 <límite> <url>"
echo " límite: Valor numérico que indica el límite en kylobytes por segundo para la descarga"
echo " url: url del archivo que se ha de descargar desde gog"
echo ""
else
# primer argumento: limite de descarga en kilobytes por segundo
# solo valor numérico y añadimos el sufijo para kilobyte
LIMITE="$1""k"
# segundo argumento: url del archivo
URL_ARCHIVO="$2"
#descargamos los archivos
wget -c --progress=bar --limit-rate="$LIMITE" "$URL_ARCHIVO"
# convertimos las secuencias de escape de una url (%HEX) a su correspondiente caracter ASCII
# código perl copiado desde Baeldung - Decoding encoded URLs in Linux
ARCHIVO="$(echo "$URL_ARCHIVO" | rev | cut -d '/' -f 1 | rev | perl -pe 's/\+/\ /g;' -e 's/%(..)/chr(hex($1))/eg;')"
URL_XML="$URL_ARCHIVO"".xml"
# intentamos descargar el archivo xml correspondiente
wget -c --progress=bar --limit-rate="$LIMITE" "$URL_XML"
# Si el estado devuelto por wget no es 0 (EXIT_SUCCESS) no hay .xml con el que trabajar
if [ "$?" -eq 0 ]
then
XML="$ARCHIVO"".xml"
# extraemos del .xml el md5 que el archivo debería tener.
MD5_XML="$(head -n 1 "$XML" | tr " " "\n" | grep -i md5 | cut -d "\"" -f 2)"
# y leemos el md5 que md5sum calcula sobre el archivo descargado
MD5_ARCHIVO="$(md5sum "$ARCHIVO" | cut -d ' ' -f 1)"
echo ""
# comparamos
if [ "$MD5_XML" = "$MD5_ARCHIVO" ]
then
echo "Descarga correcta."
else
echo "Los MD5 no coinciden:"
echo "MD5 descarga: $MD5_ARCHIVO"
echo " MD5 XML: $MD5_XML"
fi
echo ""
# el archivo .xml ya no es necesario
rm "$XML"
fi
# Y... ¡CORTEN!
fi
=== SCRIPT END ===
=== EDIT ===
Already bored of manually downloading and checking (I have too many files to download and check).
If anyone is interested, I wrote a shell script to automate things (I'm sure there is a much better way to write what the script does; please don't scold me, I use to program in C, not in Bash).
In the 'Extras' section there is much content lacking a .xml file, I added a check to know if wget was able to retrieve the corresponding .xml.
As there are no tags for indicating source code, I will use ASCII indicators:
=== SCRIPT START ===
#!/bin/bash
#sintaxis comprobamos número de argumentos
if [ "$#" -ne 2 ]
then
echo ""
echo "Sintaxis: $0 <límite> <url>"
echo " límite: Valor numérico que indica el límite en kylobytes por segundo para la descarga"
echo " url: url del archivo que se ha de descargar desde gog"
echo ""
else
# primer argumento: limite de descarga en kilobytes por segundo
# solo valor numérico y añadimos el sufijo para kilobyte
LIMITE="$1""k"
# segundo argumento: url del archivo
URL_ARCHIVO="$2"
#descargamos los archivos
wget -c --progress=bar --limit-rate="$LIMITE" "$URL_ARCHIVO"
# convertimos las secuencias de escape de una url (%HEX) a su correspondiente caracter ASCII
# código perl copiado desde Baeldung - Decoding encoded URLs in Linux
ARCHIVO="$(echo "$URL_ARCHIVO" | rev | cut -d '/' -f 1 | rev | perl -pe 's/\+/\ /g;' -e 's/%(..)/chr(hex($1))/eg;')"
URL_XML="$URL_ARCHIVO"".xml"
# intentamos descargar el archivo xml correspondiente
wget -c --progress=bar --limit-rate="$LIMITE" "$URL_XML"
# Si el estado devuelto por wget no es 0 (EXIT_SUCCESS) no hay .xml con el que trabajar
if [ "$?" -eq 0 ]
then
XML="$ARCHIVO"".xml"
# extraemos del .xml el md5 que el archivo debería tener.
MD5_XML="$(head -n 1 "$XML" | tr " " "\n" | grep -i md5 | cut -d "\"" -f 2)"
# y leemos el md5 que md5sum calcula sobre el archivo descargado
MD5_ARCHIVO="$(md5sum "$ARCHIVO" | cut -d ' ' -f 1)"
echo ""
# comparamos
if [ "$MD5_XML" = "$MD5_ARCHIVO" ]
then
echo "Descarga correcta."
else
echo "Los MD5 no coinciden:"
echo "MD5 descarga: $MD5_ARCHIVO"
echo " MD5 XML: $MD5_XML"
fi
echo ""
# el archivo .xml ya no es necesario
rm "$XML"
fi
# Y... ¡CORTEN!
fi
=== SCRIPT END ===
Post edited August 27, 2025 by DrFiemo