fix source and posting

This commit is contained in:
Dendy 2021-04-18 16:26:40 +02:00
parent dc0865f316
commit 1f7987bd55
Signed by: dendy
GPG Key ID: 0168B35FFD7F608F
2 changed files with 8 additions and 5 deletions

9
fedibooru.sh Executable file → Normal file
View File

@ -22,9 +22,11 @@ taglist=$(get_conf tags)
querybase="https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=1&json=1"
# From 1 to 20.000
randnum=$[ $RANDOM % 20000 + 1 ]
randnum=$[ $RANDOM % 6300 + 1 ]
json=$(curl "$querybase&tags=$taglist&pid=$randnum" 2> /dev/null)
query="$querybase&tags=$taglist&pid=$randnum"
json=$(curl "$query" 2> /dev/null)
# Get image info
imageurl=$(json_parser "$json" "file_url")
@ -34,6 +36,7 @@ imgsource=$(json_parser "$json" "source")
[ -d "$img_dir" ] || mkdir "$img_dir" || (echo "Error creating image folder" && exit)
wget "$imageurl" -P "$img_dir" 2> /dev/null || (echo "Could not download image" && exit)
image_json=$( \
curl -X POST "https://$instance/api/v1/media" \
-H "Authorization: Bearer $access_token" \
@ -45,5 +48,5 @@ id=$(json_parser "$image_json" "id")
curl -X POST "https://$instance/api/v1/statuses" \
-H "Authorization: Bearer $access_token" -F "media_ids[]=$id" \
-F "status=source: $imgsource" -F "sensitive=true" \
-F "status=$([ -z $imgsource ] || echo source: $imgsource)" -F "sensitive=$(get_conf sensitive)" \
-F "visibility=$(get_conf visibility)" > /dev/null 2> /dev/null

4
setup.sh Executable file → Normal file
View File

@ -65,11 +65,11 @@ echo "access_token=$access_token" >> config
echo "\n- Which visibility you want the published statuses to be? (public, unlisted, private) [public]:"
read visibility
echo "visiblity=$visibility" >> config
echo "visibility=$visibility" >> config
echo "\n- Mark images as sensitive? (yes, no) [no]"
read sensitive
[ sesnsitive = yes ] && sensitive="true" || sensitive="false"
[ sesnsitive = "yes" ] && sensitive="true" || sensitive="false"
echo "sensitive=$sensitive" >> config
echo "tags=yuki_nagato rating:safe" >> config