Guest

upbloat.sh

By: a guest on Jan 28th, 2012  |  syntax: Bash  |  size: 0.75 KB  |  hits: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. #!/bin/bash
  2.  
  3. if [ $# -eq 3 ] ; then
  4.         #curl -d user=$1 -d passwd=$2 -c Cookie.txt http://www.reddit.com/api/login
  5.         #curl -o $3.txt http://www.reddit.com/user/$3/.json
  6.        
  7.         uh=$(cat $3.txt | sed -e 's/\"modhash\": \"/\n/g' | sed -e 's/\".*//' | sed -e 's/{//' | tr -d '\r' | tr -d '\n')
  8.         echo "uh> $uh"
  9.        
  10.         arr=$(cat $3.txt | sed -e 's/\"id\": \"/\n/g' | sed -e 's/\".*//' | sed -e 's/{//')
  11.        
  12.         for x in $arr
  13.         do             
  14.                 curl -b Cookie.txt -i -H "Accept: application/json" -X POST -d "id=$x&dir=1&uh=$uh" http://www.reddit.com/api/vote
  15.         done
  16. else
  17.         echo "Please enter three args"
  18.         echo "1. your reddit username"
  19.         echo "2. your reddit password"
  20.         echo "3. the reddit user we're upbloating"
  21.         echo "e.g. ./upbloat.sh yourusername yourpassword reddituser123"
  22. fi