Skip to content

Instantly share code, notes, and snippets.

@dewomser
Created May 6, 2022 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dewomser/16d1b47101ffda371cb22f8ab059e5f9 to your computer and use it in GitHub Desktop.
Save dewomser/16d1b47101ffda371cb22f8ab059e5f9 to your computer and use it in GitHub Desktop.
Screenshot Twittern mit Kommentar
!/bin/bash
cd $HOME/bin
import tweet.png
wait
# byte="$(du -b tweet.png | cut -b -5)"
byte="$(du -b tweet.png | tr -d -c 0-9)"
user="twitter_user"
## // initialisieren mit genauer Byte größe
mis=$(twurl -u $user -H upload.twitter.com "/1.1/media/upload.json" -d "command=INIT&media_type=image/jpg&total_bytes=$byte" | jq .media_id_string)
mis="${mis:1: -1}"
#//hochladen
twurl -u $user -H upload.twitter.com "/1.1/media/upload.json" -d "command=APPEND&media_id=$mis&segment_index=0" --file tweet.png --file-field "media" | jq
#//finalisieren
twurl -u $user -H upload.twitter.com "/1.1/media/upload.json" -d "command=FINALIZE&media_id=$mis" | jq
#//text hinzufügen
# a=$(kdialog --textinputbox "Dialog-Tweeter" "$1")
a=$(kdialog --textinputbox "Dialog-Tweeter")
if [[ $? = 0 ]]; then
twurl -u $user "/1.1/statuses/update.json" -d "media_ids=$mis&status=Ein Bashscript mit payload: $a"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment