Created
March 17, 2017 10:26
-
-
Save solebox/3c2ce5efb0bfe575adf10f45be831033 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
token="your api token , make sure it has page upload permissions, too lazy to figure out how to make one? try this page: https://developers.facebook.com/tools/explorer/145634995501895/?method=GET" | |
photka="$1" | |
sched_time=$(date -d "$2" +"%s") | |
if [ -z "$1" ]; then | |
echo "usage: <photka path> [<pub-time>]" | |
echo "" | |
echo "<pub-time> values: +1 day, +1 hour, just like with date" | |
echo "" | |
echo "examples:" | |
echo " to post right now:" | |
echo " $0 ./lol.png" | |
echo " to post tommorow:" | |
echo " $0 ./lol.png 1" | |
elif [ -z "$2" ]; then | |
# post now | |
curl -i -X POST -F file1=@$photka -F "access_token=$token" "https://graph.facebook.com/v2.8/Trolling.inc/photos" | |
else | |
# sched post | |
curl -i -X POST -F file1=@$photka -F "access_token=$token" -F "published=false" -F "scheduled_publish_time=$sched_time" "https://graph.facebook.com/v2.8/Trolling.inc/photos" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment