when altbot not fast enough, dont add .. as alttext
This commit is contained in:
1 parent
f8ed501b9e
commit
7a58066c78
1 file changed
+3
-1
@@ -71,6 +71,9 @@ status=$(echo $status | jq -r '.id')
|
|||||||
|
|
||||||
alt=$(curl -X GET "https://mastodon.social/api/v1/statuses/$status/context")
|
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 using Gemini"))) | .content' | head -n 1)
|
||||||
|
|
||||||
|
if [ -n "$alt" ]; then
|
||||||
|
|
||||||
alt=$(echo "$alt" | sed -e 's/<p>/\n/g' -e 's/<\/p>/\n/g' -e 's/<[^>]*>//g' -e 's/@reddit_memebot//')
|
alt=$(echo "$alt" | sed -e 's/<p>/\n/g' -e 's/<\/p>/\n/g' -e 's/<[^>]*>//g' -e 's/@reddit_memebot//')
|
||||||
alt=$(echo "$alt" | sed 's/ */ /g' | sed 's/^ //;s/ $//')
|
alt=$(echo "$alt" | sed 's/ */ /g' | sed 's/^ //;s/ $//')
|
||||||
alt=$(echo "$alt" | sed 's/^"//;s/"$//')
|
alt=$(echo "$alt" | sed 's/^"//;s/"$//')
|
||||||
@@ -89,7 +92,6 @@ alt=$(echo "$alt" | sed 's/PLACEHOLDER_NEWLINE/\n/g')
|
|||||||
echo "Adding alt Text"
|
echo "Adding alt Text"
|
||||||
echo $alt
|
echo $alt
|
||||||
|
|
||||||
if [ -n "$alt" ]; then
|
|
||||||
# bad: using the same code twice
|
# bad: using the same code twice
|
||||||
if [ "$tags" = "null" ]; then # Check if the Post is NSFW
|
if [ "$tags" = "null" ]; then # Check if the Post is NSFW
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user