Search This Blog

Friday, March 13, 2015

Bath download tumblr.com photos

First install tgrab by pip:


# apt-get update
# apt-get install python-pip
# pip install tgrab


Then create a script to run it in bath:


#!/bin/bash

# Working Folder
WORK_DIR=$PWD

# Array storage the tumblr accounts:
# Example: cars for http://cars.tumblr.com/
array=( cars computerhistorymuseum computer macdesks )

for i in "${array[@]}"
do
echo "*****$i*****"
mkdir -p $WORK_DIR/$i
cd $WORK_DIR/$i
ls|wc -l
tgrab -n $i -p 100 > download.log 2>&1 &
done

cd $WORK_DIR


The script will go through the array then download all photos for the first 100 pages back.
Each tgrab job will running at background, the downloads will be under each folder.

Appreciate the works on tgrab.
And Pythong Rocks!

No comments:

Post a Comment