fix syntax
This commit is contained in:
1 parent
fb8a50695b
commit
2637cd0fb8
1 file changed
+11
-4
@@ -65,6 +65,7 @@ fi
|
|||||||
rm /tmp/$filename # Delete the Image
|
rm /tmp/$filename # Delete the Image
|
||||||
|
|
||||||
# Now getting alt text from altbot. | this is temporary until i finally figure stuff out.
|
# Now getting alt text from altbot. | this is temporary until i finally figure stuff out.
|
||||||
|
echo "Waiting two minutes to let altbot have time to respond"
|
||||||
sleep 120
|
sleep 120
|
||||||
status=$(echo $status | jq -r '.id')
|
status=$(echo $status | jq -r '.id')
|
||||||
|
|
||||||
@@ -73,6 +74,10 @@ alt=$(echo $alt | jq '.descendants[] | select(.account.acct == "altbot@fuzzies.w
|
|||||||
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/"$//')
|
||||||
|
alt=$(echo "$alt" | sed 's/\\"/"/g')
|
||||||
|
|
||||||
|
echo "Adding alt Text"
|
||||||
|
echo $alt
|
||||||
|
|
||||||
if [ -n "$alt" ]; then
|
if [ -n "$alt" ]; then
|
||||||
# bad: using the same code twice
|
# bad: using the same code twice
|
||||||
@@ -82,9 +87,10 @@ if [ -n "$alt" ]; then
|
|||||||
status_edit=$(curl -X PUT -H "Authorization: Bearer $ACCESS_TOKEN" \
|
status_edit=$(curl -X PUT -H "Authorization: Bearer $ACCESS_TOKEN" \
|
||||||
-F "status=$title
|
-F "status=$title
|
||||||
|
|
||||||
($url) #SFW" \
|
($url) #SFW" \
|
||||||
-F "media_ids[]=$MEDIA_ID" \
|
-F "media_ids[]=$MEDIA_ID" \
|
||||||
-F "media_attributes={\"id\":\"$MEDIA_ID\",\"description\":\"$description\"}" \
|
-F "media_attributes[][id]=$MEDIA_ID" \
|
||||||
|
-F "media_attributes[][description]=$alt" \
|
||||||
"$INSTANCE_URL/api/v1/statuses/$status")
|
"$INSTANCE_URL/api/v1/statuses/$status")
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -92,10 +98,11 @@ if [ -n "$alt" ]; then
|
|||||||
status_edit=$(curl -X PUT -H "Authorization: Bearer $ACCESS_TOKEN" \
|
status_edit=$(curl -X PUT -H "Authorization: Bearer $ACCESS_TOKEN" \
|
||||||
-F "status=$title
|
-F "status=$title
|
||||||
|
|
||||||
($url) #NSFW" \
|
($url) #NSFW" \
|
||||||
-F "sensitive=true" \
|
-F "sensitive=true" \
|
||||||
-F "media_ids[]=$MEDIA_ID" \
|
-F "media_ids[]=$MEDIA_ID" \
|
||||||
-F "media_attributes={\"id\":\"$MEDIA_ID\",\"description\":\"$description\"}" \
|
-F "media_attributes[][id]=$MEDIA_ID" \
|
||||||
|
-F "media_attributes[][description]=$alt" \
|
||||||
"$INSTANCE_URL/api/v1/statuses/$status")
|
"$INSTANCE_URL/api/v1/statuses/$status")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user