#!/bin/bash
#########################################################
# fakenews ##
# create an html digest of watched twitter accounts ##
# with https://codemadness.org/git/tscrape/ and gawk ##
#########################################################
# keep one twitter account per line in here
accountsfile=".fakenews"
outfile="/tmp/fakenews_out.html"
numberOfTweets=5
echo '
News' > $outfile
while read account; do
echo "Fetching $account..."
echo "$account
" >> $outfile
curl -H 'User-Agent:' -s "https://twitter.com/$account" |
tscrape |
head -n $numberOfTweets |
awk -F '\t' '{$1 = strftime("%d-%m-%Y %H:%M:%S",$1); print "- " $6 "
- " $4 "
" $1 " "}' |
sed 's/\([^"]\)\(https:[^ ]*\)/\1\2<\/a>/g' |
sed 's/>\(https:[^<]*.jpg\)/>PIC/g' >> $outfile
echo "
" >> $outfile
done < "$accountsfile"
echo '' >> $outfile
xdg-open $outfile