Skip to content

Instantly share code, notes, and snippets.

@andrewrcollins
Created February 6, 2012 21:03
Show Gist options
  • Save andrewrcollins/1754840 to your computer and use it in GitHub Desktop.
Save andrewrcollins/1754840 to your computer and use it in GitHub Desktop.
OpenClipArt Uploader
#!/bin/sh
AGENT="Mozilla/5.0 (Windows NT 5.1; rv:10.0) Gecko/20100101 Firefox/10.0"
SIGNIN="http://openclipart.org/signin"
USERNAME=xxxxxxxxxxx
PASSWORD=yyyyyyyyyyy
USERUPID=zzzzzzzzzzz
curl --cookie-jar cookies --user-agent "${AGENT}" --data "username=${USERNAME}&password=${PASSWORD}&process=login&submit=Sign in" --output "signin.html" "${SIGNIN}"
UPLOAD="http://openclipart.org/upload"
curl --cookie cookies --cookie-jar cookies --user-agent "${AGENT}" --output "upload.html" "${UPLOAD}"
for SVG in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
do
FILENAME="the_filename_${SVG}.svg"
UPLOAD="http://openclipart.org/index.php?pretty=upload"
curl --cookie cookies --cookie-jar cookies --user-agent "${AGENT}" \
--form filename=@${FILENAME} \
--form unique_filename="unique_filename" \
--form upload_user="${USERUPID}" \
--form user_name="${USERNAME}" \
--form upload_name="The Name ${SVG}" \
--form upload_tags="tag 1, tag 2, tag last," \
--form upload_description="The Description" \
--form upload_published="1" \
--form drawn_by="" \
--form nsfw="0" \
--form form_id="25" \
--form add_to_form="Submit" \
--output "upload.html" "${UPLOAD}"
sleep 1s
UPLOAD="http://openclipart.org/upload"
curl --cookie cookies --cookie-jar cookies --user-agent "${AGENT}" --output "upload.html" "${UPLOAD}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment