Created
September 14, 2012 20:06
A script that scrapes the image hosting website imgur.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
while [ 1 == 1 ] | |
do | |
########################################################################## | |
url=$(cat /dev/urandom | tr -cd "[:alnum:]" | head -c 5) | |
curl -f -s http://imgur.com/$url > /dev/null | |
exitstatus=$? | |
if [ $exitstatus -eq 0 ] | |
then | |
wget $(curl -s http://imgur.com/$url | grep -P '^\t\t\t\t\t\t<img' | sed 's/^.*<img src="\(http:\/\/i.imgur.com\/.....\....\).*$/\1/') >& /dev/null | |
echo Yup | |
else | |
echo Nope | |
fi | |
########################################################################## | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment