~scripts
56 itemsDownload ./*

56 itemsDownload ./*

..
display
dzen2
tiling
vosh
4cdl
4trips
alarm
ambient
battery-monitor
checkit
cleverbot.py
clock
color-gen
colors-hex
colorscheme.sh
compton.sh
dailywall
dmenu
ffthumb
grid
gridmacro
gridmacro.kde
help
importw
indexer
install-all.sh
install-twily.sh
installng
mp3ogg
orage
pipes
pipes.x
pipewire_bt.sh
ports
rain
randwall
readystart.sh
rotate.sh
scan.sh
screencast
screencast2
scrot
scrotw
search
skull
slocker
startblender.sh
starwars
streamit
sumnum
synctimedate.sh
tty-colorize
usrmount
ytp
ytplay
zombie-restart.sh


scripts4trips
2 831•  9 years ago•  DownloadRawClose
9 years ago•  2 831

{}
#!/bin/bash
#
#   Author:      Twily                   2015
#   Description: 4chan post number/id monitor
#   Usage:       $ sh ./4trips https://boards.4chan.org/g/catalog <S> <N>
#   Requires:    wget, sed
#   Note:        Allow 10 seconds margin for post ids to appear in 4trips
#                from the actual time they are posted
#


S=${2:-10}  # Seconds to wait before refresh
N=${3:-1}   # Index number of first thread in catalog

tA=0 && tB=0

while true; do
    T=$RANDOM

    echo -ne "\033[1;31m>"

    F1="4c.catalog."$T".tmp"
    F2="4c.thread."$T".tmp"

    wget $1 --quiet --no-cache --no-http-keep-alive -O ./$F1
    echo -ne "\033[1;33m>"

    sed -i 's/{/{\n/g' ./$F1
    grep \"id\" < ./$F1 > ./$F2

    sed -i 's/,"semantic.*//g' ./$F2
    sed -i 's/"id"://g' ./$F2
    sed -i 's/,".*//g' ./$F2
    sed -i 's/}//g' ./$F2

    R=$(sed $N'q;d' < ./$F2)
    D=$(date)

    tB=$tA && tA=$R
    tC=$(( $tA - $tB ))
    echo -ne "\033[1;32m> \033[0m"

    if [ "$R" != "$tC" ]; then p=""; for i in `seq 1 $tC`; do p="$p="; if [ $i -ge 80 ]; then break; fi; done; fi
    echo -e "Last Post ID   \033[1;31m$R   \033[0m$D   \033[1;30mWait "$S"s   \033[1;33m$tC \033[1;32m$p\033[0m"

    rm -f ./$F1
    rm -f ./$F2
    
    sleep $S
done

exit 0

Top
©twily.info 2013 - 2024
twily at twily dot info



2 131 257 visits
... ^ v