123456789101112131415161718192021222324252627282930313233 |
- #!/bin/bash
- # This required jq and wget
- DAY=$((60 * 60 * 24))
- # Remove instances.json when it's older then 1 day
- if [ -f "instances.json" ]; then
- NOW=$(date "+%s")
- THEN=$(date -r "instances.json" "+%s")
- DELTA=$((NOW - THEN))
- if [ $DELTA -gt $DAY ]; then
- echo "YES"
- rm "instances.json"
- fi
- fi
- # Get new instances.json
- if [ ! -f "instances.json" ]; then
- wget "https://api.invidious.io/instances.json"
- fi
- # Process
- while IFS= read -r line
- do
- URL="${line:1:-1}"
- echo "// @include https://$URL/channel/*"
- echo "// @include https://$URL/watch*"
- echo "// @include https://$URL/search*"
- echo "// @include https://$URL/feed/*"
- done <<< $(jq ".[][0]" instances.json | grep -v ".onion\|.i2p")
|