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