Skip to content

Commit

Permalink
Update news.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
gzowski authored Jan 22, 2021
1 parent 756bfd2 commit a5b7745
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions news.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
#Pulls newest reddit posts from r/politics and r/worldnews
#Auto update using watch application.

limit=30
curl -s https://www.reddit.com/r/politics+worldnews/new/.json?limit=${limit} -A Mozilla |
jq -r '.data .children[] .data | if(.score <= 700) then "\(.created_utc|strflocaltime("%H:%M:%S")) \(.score) \(.title)"," https://redd.it/\(.id) \(.domain)" else empty end' |
sed -E "s/\?utm_campaign.*//;s/&amp;.*//;s/^(..:..:..) ([0-9]{1,3}) (.*)$/\x1b[1m\1\x1b[0m \x1b[35m\2\x1b[0m\t\x1b[0;40;33m\3\x1b[0m/"
#sed -E "s/\?utm_campaign.*//;s/&amp;.*//;s/^(..:..:..) ([0-9]{1,3}) (.*)$/\1 \x1b[35m\2\x1b[0m\t\x1b[1m\3\x1b[0m/"
#watch -n15 -c -x "${com}"

0 comments on commit a5b7745

Please sign in to comment.