123456789101112131415161718192021222324252627282930 |
- #!/bin/bash
- # Set the URL of the Atom feed
- feed_url="http://demo.fedilist.com/instance/newest/rss"
- # Set the interval for checking for updates (in seconds)
- interval=600
- while true; do
- # Get the date of the last update from the feed
- last_update=$(curl -Ls "$feed_url" | xmlstarlet sel -t -v "/rss/channel/item[1]/pubDate")
- # Compare the last update date with the date of the last check
- if [ "$last_update" != "$last_check" ]; then
- # Update the date of the last check
- last_check="$last_update"
- # Parse the feed and get the link of the first entry
- urls=$(curl -Ls "$feed_url" | xmlstarlet sel -t -v "/rss/channel/item/title" | awk '{print $NF}' | sort | uniq -c | sort -nr | awk '{print $2}')
- for url in $urls; do
- cd /opt/fedi-block-api && sudo -Hu fba python3 fetch_instances.py $url
- done
- fi
- # Wait for the specified interval
- sleep $interval
- done
|