fixing altbot alttext grep

This commit is contained in:
D5k H3h
2025-09-03 22:15:41 +02:00
committed by GitHub
parent bc3ad723ed
commit 2cbf7391f5
+3 -2
View File
@@ -6,7 +6,7 @@ ACCESS_TOKEN="my_bot_token" # Mastodon Access Token
SUBREDDIT="memes" # Subreddit (must be Image Only, like r/memes)
# Fetch the JSON feed
json=$(curl -H 'User-Agent: Mozilla/5.0' "https://bridge.easter.fr/?action=display&bridge=RedditBridge&context=single&r=$SUBREDDIT&f=&score=&d=hot&search=&format=Json" 2>/dev/null)
json=$(curl -H 'User-Agent: Mozilla/5.0' "https://rss.husch.ovh/?action=display&bridge=RedditBridge&context=single&r=$SUBREDDIT&f=&score=&d=hot&search=&format=Json" 2>/dev/null)
# extract the first item
item=$(echo "$json" | jq '.items[0]')
@@ -70,7 +70,7 @@ sleep 120
status=$(echo $status | jq -r '.id')
alt=$(curl -X GET "https://mastodon.social/api/v1/statuses/$status/context")
alt=$(echo $alt | jq '.descendants[] | select(.account.acct == "altbot@fuzzies.wtf" and (.content | contains("generated using Gemini"))) | .content' | head -n 1)
alt=$(echo $alt | jq '.descendants[] | select(.account.acct == "altbot@fuzzies.wtf" and (.content | contains("generated privately and locally using"))) | .content' | head -n 1)
if [ -n "$alt" ]; then
@@ -91,6 +91,7 @@ alt=$(echo "$alt" | sed 's/PLACEHOLDER_NEWLINE/\n/g')
echo "Adding alt Text"
echo $alt
# bad: using the same code twice
if [ "$tags" = "null" ]; then # Check if the Post is NSFW