Update memes.sh
This commit is contained in:
1 parent
34bb368a74
commit
cb3be9eac1
1 file changed
+13
@@ -14,6 +14,7 @@ item=$(echo "$json" | jq '.items[0]')
|
|||||||
# extract the title and URL
|
# extract the title and URL
|
||||||
title=$(echo "$item" | jq -r '.title')
|
title=$(echo "$item" | jq -r '.title')
|
||||||
url=$(echo "$item" | jq -r '.url')
|
url=$(echo "$item" | jq -r '.url')
|
||||||
|
tags=$(echo "$item" | jq -r '.tags')
|
||||||
|
|
||||||
# extract the image URL from the content_html
|
# extract the image URL from the content_html
|
||||||
content_html=$(echo "$item" | jq -r '.content_html')
|
content_html=$(echo "$item" | jq -r '.content_html')
|
||||||
@@ -35,6 +36,9 @@ MEDIA_ID=$(curl -X POST -H "Authorization: Bearer $ACCESS_TOKEN" \
|
|||||||
"$INSTANCE_URL/api/v1/media" \
|
"$INSTANCE_URL/api/v1/media" \
|
||||||
| jq -r '.id')
|
| jq -r '.id')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$tags" = "null" ]; then
|
||||||
# Post the status with the image
|
# Post the status with the image
|
||||||
curl -X POST -H "Authorization: Bearer $ACCESS_TOKEN" \
|
curl -X POST -H "Authorization: Bearer $ACCESS_TOKEN" \
|
||||||
-F "status=$title
|
-F "status=$title
|
||||||
@@ -42,4 +46,13 @@ curl -X POST -H "Authorization: Bearer $ACCESS_TOKEN" \
|
|||||||
($url)" \
|
($url)" \
|
||||||
-F "media_ids[]=$MEDIA_ID" \
|
-F "media_ids[]=$MEDIA_ID" \
|
||||||
"$INSTANCE_URL/api/v1/statuses"
|
"$INSTANCE_URL/api/v1/statuses"
|
||||||
|
else
|
||||||
|
# Post the status with the image and make it NSFW
|
||||||
|
curl -X POST -H "Authorization: Bearer $ACCESS_TOKEN" \
|
||||||
|
-F "status=$title
|
||||||
|
|
||||||
|
($url)" \
|
||||||
|
-F "spoiler_text=NSFW Meme" \
|
||||||
|
-F "media_ids[]=$MEDIA_ID" \
|
||||||
|
"$INSTANCE_URL/api/v1/statuses"
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user