2020-04-21 22:24:30 +02:00
|
|
|
#!/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"
|
2020-04-21 22:30:35 +02:00
|
|
|
numberOfTweets=5
|
2020-04-21 22:24:30 +02:00
|
|
|
|
2020-05-02 09:03:20 +02:00
|
|
|
echo '<html><head><title>News</title><style>a { color : black; } a:hover { color : red; } </style></head><body>' > $outfile
|
2020-04-21 22:24:30 +02:00
|
|
|
|
|
|
|
while read account; do
|
2020-04-21 22:33:46 +02:00
|
|
|
echo "Fetching $account..."
|
2020-04-21 22:24:30 +02:00
|
|
|
echo "<h3>$account</h3><dl>" >> $outfile
|
|
|
|
curl -H 'User-Agent:' -s "https://twitter.com/$account" |
|
2020-05-02 09:09:12 +02:00
|
|
|
tscrape |
|
|
|
|
head -n $numberOfTweets |
|
|
|
|
awk -F '\t' '{$1 = strftime("%d-%m-%Y %H:%M:%S",$1); print "<dt>" $6 "</dt><dd>" $4 " <br><small><a href=\"https://twitter.com/" $6 "/status/" $5 "\">" $1 "</a></small></dd>"}' |
|
2020-05-02 09:13:22 +02:00
|
|
|
sed 's/\([^"]\)\(https:[^ ]*\)/\1<a href="\2">\2<\/a>/g' |
|
2020-05-02 09:09:12 +02:00
|
|
|
sed 's/>\(https:[^<]*.jpg\)/>PICTURE/g' >> $outfile
|
2020-04-21 22:24:30 +02:00
|
|
|
echo "</dl>" >> $outfile
|
|
|
|
done < "$accountsfile"
|
|
|
|
|
|
|
|
echo '</body></html>' >> $outfile
|
|
|
|
xdg-open $outfile
|