Advertisement
Guest User

Untitled

a guest
Jun 10th, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.85 KB | None | 0 0
  1. #!/bin/bash
  2. board=$(echo "$1" | grep -o '\.org/[^/]*' | grep -o '[^/]*$')
  3. curl -sL "$1" | grep -oE '"no":[0-9]*(,"[^"]*":([0-9]*|"([^\"]|\\.)*"))*' | grep '"ext":".png"' | while read line; do
  4.   no=$(   echo "$line" | grep -o '"no":[0-9]*'    | grep -o '[0-9]*')
  5.   resto=$(echo "$line" | grep -o '"resto":[0-9]*' | grep -o '[0-9]*')
  6.   tim=$(  echo "$line" | grep -o '"tim":[0-9]*'   | grep -o '[0-9]*')
  7.   post="http://boards.4chan.org/$board/thread/$((resto ? resto : no))#p$no"
  8.   file="http://i.4cdn.org/$board/$tim.png"
  9.   type=$(curl -s -H 'Range:bytes=25-25' "$file")
  10.   if [ "$type" = $'\003' ] || [ "$type" = $'\006' ]; then
  11.     tmp=$(mktemp)
  12.     curl -s "$url" > "$tmp"
  13.     x=$(convert "$file" png32:- | wc -c)
  14.     y=$(convert "$file" -alpha background png32:- | wc -c)
  15.     echo $((x ? (x-y)*1000/x : 0)) "$post" "$file"
  16.     rm "$tmp"
  17.   fi
  18. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement