#!/bin/bash
#title :iconosquare photo grabber
#description :Script will ask you for a word/phrase to search and then
# pull all photos with that as a tag.
#author :Kris Occhipinti
#date :2014-07-22
#version :0.1
#Site :http://filmsbykris.com
#License :GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt
#==============================================================================
url="http://iconosquare.com/controller_nl.php?action=nlGetMethod&method=mediasTag&value="
echo "Please enter a search term [example, 'linux']:"
read tag
echo "Grabbing images tagged as $tag"
mkdir "photos_$tag"
cd "photos_$tag"
wget -q "${url}${tag}" -O-|\
sed 's/http/\nhttp/g'|\
grep http|grep '_n.jpg'|\
cut -d\" -f1|\
sort -u|\
sed 's/\\//g'|\
while read line;
do
wget -c "$line"
done