Skip to content

Instantly share code, notes, and snippets.

@lg
Created August 30, 2011 00:09
Show Gist options
  • Save lg/1179762 to your computer and use it in GitHub Desktop.
Save lg/1179762 to your computer and use it in GitHub Desktop.
Download all booths from a dailybooth user
# replace USERNAMEHERE with the username of the user whose booths you'd like to copy (there are 4 instances you need to find/replace
echo "" > out.csv
CUR_PAGE=1
while true; do
curl --silent "http://dailybooth.com/USERNAMEHERE/quilt/page/$CUR_PAGE" > page.html
if ! grep "div><a href=\"/USERNAMEHERE/" page.html > /dev/null; then
echo "Done"
break
else
echo "Page $CUR_PAGE"
for id in `perl -n -e '/\/USERNAMEHERE\/(\d+).*?\// && print "$1\n"' page.html`; do
echo " $id"
echo -en $id >> out.csv
echo -en "\t" >> out.csv
curl --silent "http://dailybooth.com/USERNAMEHERE/$id" > details.html
cat details.html | perl -0777 -ne 'print "$1" while /<p class="when">\n {8}(.*?)\n {6}<\/p><p class="views">/gs' >> out.csv
echo -en "\t" >> out.csv
cat details.html | perl -0777 -ne 'print "$1" if /(http:\/\/cdn\d.dailybooth.com\/\d\/pictures\/large\/.*?)\"/' >> out.csv
echo -en "\t" >> out.csv
cat details.html | perl -0777 -ne 'print "$1" while /id="blurb">\n {4}(.*?)\n/gs' >> out.csv
echo -en "\t" >> out.csv
echo -en "\n" >> out.csv
done
CUR_PAGE=$(($CUR_PAGE+1))
fi
done
@CJCA915
Copy link

CJCA915 commented Oct 25, 2012

I'm new, but how do I use this?

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