Skip to content

Instantly share code, notes, and snippets.

@dewomser
Created March 20, 2019 06:18
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/3873d1ba96a37d277efba7978d86636f to your computer and use it in GitHub Desktop.
Save dewomser/3873d1ba96a37d277efba7978d86636f to your computer and use it in GitHub Desktop.
Twitter+ Twurl Tweet mit Bild
// Beispiel Twurl Tweet mit Bild
// initialisieren mit genauer Byte größe
twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=INIT&media_type=image/jpg&total_bytes=2204" | jq
//Das mittlere ist das richtige
{
"media_id": 1108021296946917400,
"media_id_string": "1108021296946917377",
"expires_after_secs": 86399
}
//hochladen
twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=APPEND&media_id=1108021296946917377&segment_index=0" --file test.png --file-field "media" | jq
//finalisieren
twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=FINALIZE&media_id=1108021296946917377" | jq
//text hinzufügen
twurl "/1.1/statuses/update.json" -d "media_ids=1108021296946917377&status=Sample Tweet with media_ids and twurl"
@dewomser
Copy link
Author

Twurl
Upload image and tweet.
media_id_string is generated by twitter, and must be changed at every init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment