shithub: oktreader

ref: 2297c0a88d80c890d813ee0b7ebfef8408630cee
dir: /oktr/

View raw version
#!/bin/rc
# ok, turing. reader
rfork e

slp = .5
prev = 5 # preview lines 
posts = 1
inp = 0

fn more {


}

# begin

while (! ~ $inp q ) {
for (i in `{hget 'http://okturing.com:80/?tags=all&start='^$posts | grep '<a href' | grep -v 'right' | tr ' ' '_'} ) {
 url = `{ echo $i | awk -F'"' '{print $2}' }
 date = `{ echo $i | awk -F'>' '{print $3}' | awk -F'<' '{print $1}' | tr '_' ' ' }

 echo
 echo '#########'
 echo $date
 echo $url
 echo

 hget `{echo $i | awk -F'"' '{print $2}' } | sed $prev^q
 # if ^ is longer than $prev lines - print "there is more"
 # i dont want to hget the url twice though and i dont want to save it locally
 echo
 echo ( ... there may be more)
}

echo ... load more? q - quit, anything else cont.
posts = `{ echo $posts + 11 | bc }
inp = `{read}
}