fix source and posting
This commit is contained in:
parent
dc0865f316
commit
1f7987bd55
|
@ -22,9 +22,11 @@ taglist=$(get_conf tags)
|
||||||
querybase="https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=1&json=1"
|
querybase="https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=1&json=1"
|
||||||
|
|
||||||
# From 1 to 20.000
|
# 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
|
# Get image info
|
||||||
imageurl=$(json_parser "$json" "file_url")
|
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)
|
[ -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)
|
wget "$imageurl" -P "$img_dir" 2> /dev/null || (echo "Could not download image" && exit)
|
||||||
|
|
||||||
|
|
||||||
image_json=$( \
|
image_json=$( \
|
||||||
curl -X POST "https://$instance/api/v1/media" \
|
curl -X POST "https://$instance/api/v1/media" \
|
||||||
-H "Authorization: Bearer $access_token" \
|
-H "Authorization: Bearer $access_token" \
|
||||||
|
@ -45,5 +48,5 @@ id=$(json_parser "$image_json" "id")
|
||||||
|
|
||||||
curl -X POST "https://$instance/api/v1/statuses" \
|
curl -X POST "https://$instance/api/v1/statuses" \
|
||||||
-H "Authorization: Bearer $access_token" -F "media_ids[]=$id" \
|
-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
|
-F "visibility=$(get_conf visibility)" > /dev/null 2> /dev/null
|
||||||
|
|
|
@ -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]:"
|
echo "\n- Which visibility you want the published statuses to be? (public, unlisted, private) [public]:"
|
||||||
read visibility
|
read visibility
|
||||||
echo "visiblity=$visibility" >> config
|
echo "visibility=$visibility" >> config
|
||||||
|
|
||||||
echo "\n- Mark images as sensitive? (yes, no) [no]"
|
echo "\n- Mark images as sensitive? (yes, no) [no]"
|
||||||
read sensitive
|
read sensitive
|
||||||
[ sesnsitive = yes ] && sensitive="true" || sensitive="false"
|
[ sesnsitive = "yes" ] && sensitive="true" || sensitive="false"
|
||||||
echo "sensitive=$sensitive" >> config
|
echo "sensitive=$sensitive" >> config
|
||||||
|
|
||||||
echo "tags=yuki_nagato rating:safe" >> config
|
echo "tags=yuki_nagato rating:safe" >> config
|
||||||
|
|
Loading…
Reference in New Issue