news/update.sh
ngn 53e63a96a4
add the i2p news post
Signed-off-by: ngn <ngn@ngn.tf>
2025-05-13 01:22:07 +03:00

26 lines
448 B
Bash
Executable File

#!/bin/bash
feed=$(curl 'https://ngn.tf/api/v1/news/en' --silent)
if [ $? -ne 0 ] || [ -z "${feed}" ]; then
echo "failed to get the feed"
exit 1
fi
for p in posts/*; do
title="$(jq -r .title.en "${p}")"
if [[ "${feed}" == *"${title}"* ]]; then
echo "${p} is already posted, skipping"
continue
fi
echo "posting ${p}"
admin_script add_news "${p}"
if [ $? -ne 0 ]; then
echo "failed to post ${p}"
break
fi
done