fake-firehose/scripts/get-stream.sh
2022-12-17 18:55:34 -05:00

24 lines
535 B
Bash
Executable file

host=$1
while true
do
today=`date +"%Y%m%d"`
curl -X "GET" "https://$host/api/v1/streaming/public?&local=true" \
--no-progress-meter | \
tee -a "/data/$today.json" | \
grep url | \
sed 's/data://g' | \
while read -r line
do
if [[ $line == *"uri"* ]]
then
url=`echo $line | jq .url| sed 's/\"//g'`
uri=`echo $line | jq .uri| sed 's/\"//g'`
echo "$host $url"
echo $uri >> "$today.uris.txt"
fi
done
done