updated configs
This commit is contained in:
parent
468e2805dd
commit
47c5318dd1
47
1-Privacy-Front-Ends/invidious/checkytblock.sh
Executable file
47
1-Privacy-Front-Ends/invidious/checkytblock.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
#if [ "$http_code" -eq 500 ] && ( grep -q "YouTube is currently trying to block Invidious instances." "$response_body" || grep -q "Watch on the latest version of YouTube." "$response_body"; ) then
|
||||
#while true; do
|
||||
instance="iv.datura.network"
|
||||
randomvideo=$(curl https://$instance/feed/popular 2>/dev/null | grep "watch?v=" | grep -v "title" | grep -v "index" | sed -En "s/.*href=\"\///p" | sed -En "s/\"><p dir.*//p" | shuf -n 1)
|
||||
msg=$(curl https://$instance/$randomvideo 2>/dev/null | grep "YouTube is currently trying to block Invidious instances.")
|
||||
msg2=$(curl https://$instance/$randomvideo 2>/dev/null | grep "Watch on the latest version of YouTube.")
|
||||
msg3=$(curl https://$instance/$randomvideo 2>/dev/null | grep "This helps protect our community. Learn more")
|
||||
#echo "msg = $msg"
|
||||
#echo "msg2= $msg2"
|
||||
#echo "msg3= $msg3"
|
||||
#if [ $(echo $msg | wc -w) -ne 0 ] || [ $(echo $msg2 | wc -w) -ne 0 ] || [ $(echo $msg3 | wc -w) -ne 0 ]; then
|
||||
if [ $(echo $msg | wc -w) -ne 0 ] || [ $(echo $msg2 | wc -w) -ne 0 ]; then
|
||||
echo $(echo $msg | wc -w)
|
||||
echo "KO - yt blocks instance!"
|
||||
echo "RESTARTING GLUETUN OPENVPN SERVICE TO CHANGE VPN LOCATION!"
|
||||
#/srv/invidious/restartvpn.sh
|
||||
curl -X GET "http://127.0.0.1:8000/v1/publicip/ip" # Get old IP
|
||||
curl -X GET "http://127.0.0.1:8001/v1/publicip/ip" # Get old IP
|
||||
curl -X PUT -H "Content-Type: application/json" -d '{"status":"stopped"}' "http://127.0.0.1:8000/v1/openvpn/status" # Stop
|
||||
curl -X PUT -H "Content-Type: application/json" -d '{"status":"stopped"}' "http://127.0.0.1:8001/v1/openvpn/status" # Stop
|
||||
sleep 5
|
||||
curl -X PUT -H "Content-Type: application/json" -d '{"status":"running"}' "http://127.0.0.1:8000/v1/openvpn/status" # Start
|
||||
curl -X PUT -H "Content-Type: application/json" -d '{"status":"running"}' "http://127.0.0.1:8001/v1/openvpn/status" # Start
|
||||
sleep 5
|
||||
curl -X GET "http://127.0.0.1:8000/v1/openvpn/status" # Status
|
||||
curl -X GET "http://127.0.0.1:8001/v1/openvpn/status" # Status
|
||||
curl -X GET "http://127.0.0.1:8000/v1/publicip/ip" # Get new IP
|
||||
curl -X GET "http://127.0.0.1:8001/v1/publicip/ip" # Get new IP
|
||||
|
||||
|
||||
date >> /var/log/invidiousrotations.txt
|
||||
|
||||
else
|
||||
echo " OK - yt is not blocking $instance - $randomvideo - $(date)"
|
||||
fi
|
||||
if [ $(curl https://$instance 2>/dev/null | grep 502 | wc -l) -ne 0 ]; then
|
||||
echo "KO - inv crashed"
|
||||
docker-compose -f /srv/invidious/docker-compose.yml down --remove-orphans ; docker-compose -f /srv/invidious/docker-compose.yml up -d
|
||||
|
||||
fi
|
||||
#sleep 10
|
||||
#done
|
||||
|
||||
|
||||
|
@ -7,5 +7,6 @@ rsync datura:/var/spool/cron/crontabs/root ./crontab.txt
|
||||
rsync datura:/etc/nginx/sites-available/iv.datura.network nginx.conf
|
||||
rsync datura:/srv/invidious/nginx.conf nginx.invidiousservice.loadbalancing.conf
|
||||
rsync datura:/etc/nginx/sites-available/iv.datura.network.tor.conf nginx.conf.tor
|
||||
rsync datura:/root/checkytblock.sh checkytblock.sh
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user