Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- main()
- {
- API_KEY=00000000000000
- PHOTOSET_ID=0000000000000000
- ping -c 2 208.77.188.166 > /dev/null
- if [ "$?" -eq 0 ]
- then
- SAVETO=`tempfile`
- curl -s -o $SAVETO "http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=$API_KEY&photoset_id=$PHOTOSET_ID"
- PHOTO=$(($RANDOM % (`wc -l $SAVETO | cut -f1 --delim=\ ` -4)))
- IDSECRET=`head -n $PHOTO $SAVETO | tail -n 1 | sed -e 's/.*id=\"\([0-9]\+\)\" secret=\"\([0-9a-f]\+\)\".*/\1 \2/'`
- ID=`echo $IDSECRET | cut -f1 --delim=\ `
- SECRET=`echo $IDSECRET | cut -f2 --delim=\ `
- PHOTOURL=`curl -s "http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key=$API_KEY&photo_id=$ID&secret=$SECRET" | grep isfavorite | grep originalsecret | sed -e 's#<photo id="\([0-9]\+\)" secret="[0-9a-f]\+" server="\([0-9]\+\)" farm="\([0-9]\+\)" dateuploaded="[0-9]\+" isfavorite="." license="." rotation="." originalsecret="\([0-9a-f]\+\)" originalformat="\([a-z0-9]\+\)" media="photo">#http://farm\3.static.flickr.com/\2/\1_\4_o.\5#'`
- cd /tmp
- wget $PHOTOURL
- fbsetbg `echo $PHOTOURL | sed -e 's#.*/\(.*\)$#\1#'`
- rm $SAVETO
- else
- sleep 30
- main
- fi
- }
- main
Advertisement
Add Comment
Please, Sign In to add comment