Wednesday, November 24, 2010

Posting on Twitpic from commanline



All of us like posting picture on twitter using twitpic. But most of us hate to go their website and do several clicks to reach upload page.  If you think similarly then here is command line method using curl to upload your pic. Linux, Unix and Mac users already have curl installed. Windows users must install curl utility to make this command work (or better switch to Ubuntu). 


Command -  
curl -F "username=TwitterUserId" --form-string "password=TwitterPassword" --form-string "message='MessageToTePosted'" -F "media=@yourPathToImage"  http://twitpic.com/api/uploadAndPost


where 
TwitterUserId is your Twitter User Id
TwitterPassword  is your Twitter Password
MessageToBePosted is message you want to post on twitter
yourPathToImage is path to the image

You can easily write a script to avoid typing this long command again and again. Also, if you want to upload multiple pictures at one time, writing a simple script might help.


Please note that twitpic uses http and not https for their api and thus your password might be at some risk. I wish they use https soon.



No comments:

Post a Comment