forked from mirror/fake-firehose
Add archive mode where JSON is saved only
This commit is contained in:
parent
f561bb4521
commit
2acfdf264f
4 changed files with 24 additions and 20 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,4 +12,4 @@ data/20221219.json
|
||||||
config/hashtag-urls.txt
|
config/hashtag-urls.txt
|
||||||
config/urls.txt
|
config/urls.txt
|
||||||
data/20221219.uris.txt
|
data/20221219.uris.txt
|
||||||
./data/*
|
data/*
|
|
@ -1,7 +1,7 @@
|
||||||
version: "3.9 "
|
version: "3.9 "
|
||||||
|
|
||||||
services:
|
services:
|
||||||
fake-firehose:
|
firehose-archive:
|
||||||
build: .
|
build: .
|
||||||
image: fakefirehose:latest
|
image: fakefirehose:latest
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -82,7 +82,7 @@ cat /config/hashtag-urls.txt >> /config/urls.txt
|
||||||
cat /config/urls.txt | while read -r url
|
cat /config/urls.txt | while read -r url
|
||||||
do
|
do
|
||||||
echo "Opening $url to stream"
|
echo "Opening $url to stream"
|
||||||
sleep 1s
|
sleep 0.1s
|
||||||
./stream-url.sh $url &
|
./stream-url.sh $url &
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -12,26 +12,30 @@ do
|
||||||
today=`date +"%Y%m%d"`
|
today=`date +"%Y%m%d"`
|
||||||
|
|
||||||
echo "Starting to stream $url in 5 seconds"
|
echo "Starting to stream $url in 5 seconds"
|
||||||
|
echo "Archive status is $archive"
|
||||||
|
|
||||||
sleep 5s;
|
sleep 5s;
|
||||||
|
|
||||||
curl -X "GET" "$url" \
|
if [[ $archive != "true" ]]
|
||||||
--no-progress-meter | \
|
then
|
||||||
tee -a "/data/$today.json" | \
|
curl -X "GET" "$url" \
|
||||||
grep url | \
|
--no-progress-meter | \
|
||||||
sed 's/data://g' | \
|
tee -a "/data/$today.json" | \
|
||||||
|
grep url | \
|
||||||
|
sed 's/data://g' | \
|
||||||
|
|
||||||
while read -r line
|
while read -r line
|
||||||
do
|
do
|
||||||
|
if [[ $line == *"uri"* ]]
|
||||||
|
then
|
||||||
|
url=`echo $line | jq .url| sed 's/\"//g'`
|
||||||
|
uri=`echo $line | jq .uri| sed 's/\"//g'`
|
||||||
|
|
||||||
if [[ $line == *"uri"* ]]
|
echo "STREAMING from $host $url"
|
||||||
then
|
echo $uri >> "/data/$today.uris.txt"
|
||||||
url=`echo $line | jq .url| sed 's/\"//g'`
|
fi
|
||||||
uri=`echo $line | jq .uri| sed 's/\"//g'`
|
done
|
||||||
|
else
|
||||||
echo "STREAMING from $host $url"
|
curl -X "GET" "$url" --no-progress-meter >> "/data/$today.$host.json"
|
||||||
echo $uri >> "/data/$today.uris.txt"
|
fi
|
||||||
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
done
|
Loading…
Reference in a new issue