El blog de Juan Palómez

22 noviembre 2010

Upload multiple files to tumblr

Filed under: Uncategorized — Etiquetas: , — thisisoneball @ 19:13

This is an example of a photo upload using the Tumblr API and cURL:

curl -s -F "email=me@hotmail.com" -F "password=mypass" -F "type=photo" -F "tags=tag1,tag2" \
-F "data=@picture.jpg"  http://www.tumblr.com/api/write

If nothing goes wrong, this will print the tumblr post ID of the post you have just created.

See here for other parameters that you can change or add to that command (queuing the post, setting a caption, uploading different types of content …)

This is a simple bash script that uploads all the JPG files in the current folder, in a random order, adding them to your tumblr queue (instead of posting them now):

IFS=$'\n'     # needed if the jpg filenames contain spaces (restore the value later with  IFS=$' \t\n'  or close the terminal)

for file in $(ls *.JPG *.jpg | shuf)       # shuf randomizes the jpg filenames
echo $file
curl -s -F "email=me@hotmail.com" -F "password=mypass" -F "type=photo" -F "state=queue"  \
-F "data=@$file"  http://www.tumblr.com/api/write
sleep 5s                               # waits between uploads

3 comentarios »

  1. im testing your code.. if use state=queue , use too publish-on parameter e.g. “publish-on=2010-01-15T13:34:00” (year/month/day….)

    Comentario por angelblade — 7 marzo 2011 @ 18:59

  2. i made a modification http://twitpic.com/47x1f0/full

    Comentario por angelblade — 9 marzo 2011 @ 23:03

  3. Thanks. I use state=queue but I use the Tumblr auto posting feature.
    What OS did you use for the test?

    Comentario por thisisoneball — 21 marzo 2011 @ 00:44

RSS feed for comments on this post. TrackBack URI


Por favor, inicia sesión con uno de estos métodos para publicar tu comentario:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión /  Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )


Conectando a %s

Blog de WordPress.com.

A %d blogueros les gusta esto: