rss generator update
This commit is contained in:
28
README.md
28
README.md
@@ -1,13 +1,13 @@
|
|||||||
#### 1. Genera una pagina html con il link aggiornato di streamingcommunity (richiede "attuale.txt"):
|
#### 1. Genera una pagina html con il link aggiornato di streamingcommunity (richiede "attuale.txt"):
|
||||||
|
|
||||||
```
|
```
|
||||||
# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provarla in locale
|
# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provare in locale
|
||||||
nano make_index.sh
|
nano make_index.sh
|
||||||
|
|
||||||
# Avvia lo script manualmente
|
# Avvia lo script manualmente
|
||||||
./make_index.sh
|
./make_index.sh
|
||||||
|
|
||||||
# o mettilo in cron
|
# oppure mettilo in cron
|
||||||
0 0 * * * /path/to/make_index.sh
|
0 0 * * * /path/to/make_index.sh
|
||||||
```
|
```
|
||||||
##### 1.1 Se vuoi pubblicarla sul web, mettila dietro un reverseproxy e dai i permessi alla cartella contenente lo script:
|
##### 1.1 Se vuoi pubblicarla sul web, mettila dietro un reverseproxy e dai i permessi alla cartella contenente lo script:
|
||||||
@@ -16,20 +16,22 @@ nano make_index.sh
|
|||||||
sudo chown -R www-data:www-data <path_to_streamingcommunity_directory> ; sudo chmod -R 755 <path_to_streamingcommunity_directory>
|
sudo chown -R www-data:www-data <path_to_streamingcommunity_directory> ; sudo chmod -R 755 <path_to_streamingcommunity_directory>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### 2. Crea un feed rss con il link (richiede "attuale.txt"):
|
||||||
|
```
|
||||||
|
# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provare in locale
|
||||||
|
nano rss_generator.sh
|
||||||
|
|
||||||
|
# Avvia lo manualmente
|
||||||
|
./rss_generator.sh
|
||||||
|
|
||||||
|
# oppure mettilo in cron
|
||||||
|
0 0 * * * /path/to/rss_generator.sh
|
||||||
|
```
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
#### 2. Se vuoi semplicemente sapere qual'è il link giusto aggiornato esegui "show_link.sh" (richiede "attuale.txt"):
|
#### 3. Se vuoi semplicemente sapere qual'è il link giusto aggiornato esegui "show_link.sh" (richiede "attuale.txt"):
|
||||||
```
|
```
|
||||||
./show_link.sh
|
./show_link.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
#### 3. Crea un feed rss (richiede "attuale.txt"):
|
|
||||||
```
|
|
||||||
# Avvialo manualmente
|
|
||||||
./rss_generator.sh
|
|
||||||
|
|
||||||
# o mettilo in cron
|
|
||||||
0 0 * * * /path/to/rss_generator.sh
|
|
||||||
```
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
### xx-xx-2024
|
|
||||||
prof
|
|
||||||
|
|
||||||
### 11-01-2025
|
|
||||||
ooo
|
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO:
|
# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO:
|
||||||
|
# Es: PWD_SC="/var/www/html/streamingcommunity"
|
||||||
PWD_SC="$PWD"
|
PWD_SC="$PWD"
|
||||||
|
|
||||||
# Se il link è stato aggiornato, aggiorna il file "attuale.txt"
|
# Se il link è cambiato, allora aggiorna il file "attuale.txt"
|
||||||
attuale="$(cat "$PWD_SC/attuale.txt")"
|
attuale="$(cat "$PWD_SC/attuale.txt")"
|
||||||
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
|
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
|
if [ "$attuale" != "$nuovo" ]; then
|
||||||
@@ -13,7 +14,7 @@ fi
|
|||||||
|
|
||||||
# Formatta il link e lo stampa
|
# Formatta il link e lo stampa
|
||||||
formatted="https://$(cat "$PWD_SC/attuale.txt")"
|
formatted="https://$(cat "$PWD_SC/attuale.txt")"
|
||||||
echo "$formatted" #per debug
|
echo "$formatted"
|
||||||
|
|
||||||
# Crea pagina "index.html"
|
# Crea pagina "index.html"
|
||||||
cat <<- _EOF > $PWD_SC/index.html
|
cat <<- _EOF > $PWD_SC/index.html
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO:
|
# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO:
|
||||||
|
# Es: PWD_SC="/var/www/html/streamingcommunity"
|
||||||
PWD_SC="$PWD"
|
PWD_SC="$PWD"
|
||||||
|
|
||||||
# Formatta il link e lo stampa
|
# Formatta il link e lo stampa
|
||||||
formatted="https://$(cat "$PWD_SC/attuale.txt")"
|
formatted="https://$(cat "$PWD_SC/attuale.txt")"
|
||||||
echo "$formatted" #per debug
|
echo "$formatted"
|
||||||
|
|
||||||
data=$(date +%Y-%m-%d)
|
data=$(date +%Y-%m-%d)
|
||||||
|
|
||||||
# Crea pagina "index.html"
|
# Crea pagina "rss.xml"
|
||||||
cat <<- _EOF > $PWD_SC/rss.xml
|
cat <<- _EOF > $PWD_SC/rss.xml
|
||||||
|
|
||||||
<rss version="2.0">
|
<rss version="2.0">
|
||||||
@@ -31,4 +32,4 @@ cat <<- _EOF > $PWD_SC/rss.xml
|
|||||||
_EOF
|
_EOF
|
||||||
|
|
||||||
# Da i permessi alla cartella
|
# Da i permessi alla cartella
|
||||||
#sudo chown -R www-data:www-data $PWD_SC ; sudo chmod -R 755 $PWD_SC
|
sudo chown -R www-data:www-data $PWD_SC ; sudo chmod -R 755 $PWD_SC
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# SETTARE QUESTA VARIABILE SE LO SCRIPT NON VIENE USATO IN LOCALE:
|
# SETTARE QUESTA VARIABILE SE LO SCRIPT NON VIENE USATO IN LOCALE:
|
||||||
PWD_SC="$PWD"
|
PWD_SC="$PWD"
|
||||||
|
|
||||||
# Se il link è stato aggiornato, aggiorna il file "attuale.txt"
|
# Se il link è cambiato, allora aggiorna il file "attuale.txt"
|
||||||
attuale=$(<$PWD_SC/attuale.txt)
|
attuale=$(<$PWD_SC/attuale.txt)
|
||||||
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
|
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
|
if [ "$attuale" != "$nuovo" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user