diff --git a/README.md b/README.md index bcab874..4198459 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ### Genera una pagina html con il link aggiornato di streamingcommunity ``` -# Per generare la pagina index.html contente il link giusto: +# Per generare la pagina index.html contente il link giusto (richiede "attuale.txt"): # 1. Avvia lo script manualmente ./update_link.sh @@ -11,6 +11,10 @@ #Se vuoi pubblicarla sul web, dai i permessi alla cartella contenente lo script: - sudo chown -R www-data:www-data ; sudo chmod -R 755 ``` + +``` +# Se vuoi semplicemente sapere qual'รจ il link giusto aggiornato esegui "script_link.sh" (richiede "attuale.txt"): +./script_link.sh +``` \ No newline at end of file diff --git a/script_link.sh b/script_link.sh index 3134a9d..3796ea8 100755 --- a/script_link.sh +++ b/script_link.sh @@ -1,4 +1,9 @@ -attuale=$().*?(?=

)' | grep -oP 'https://streamingcommunity.*') -echo "$nuovo" > attuale.txt -echo -e "\n$nuovo\n" +#!/bin/bash + +attuale=$(<$PWD/attuale.txt) +nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?') +if [ "$attuale" != "$nuovo" ]; then + attuale="$nuovo" + echo "$attuale" > $PWD/attuale.txt +fi +echo -e "\n $attuale\n"