Thursday, July 28, 2016

Geektool for BBC News

I've been using Geektool on and off for some time now for my Desktop needs. Here is a quick script that will show top news from various sources from the BBC. Adjust accordingly...

#!/bin/sh

URL="http://feeds.bbci.co.uk/news/world/rss.xml"
#URL="http://feeds.bbci.co.uk/news/technology/rss.xml"
#URL="http://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml"

if [ $# -eq 1 ] ; then
  headarg=$(( $1 * 2 ))
else
  headarg="-8"
fi

/bin/date
echo ""
echo "      BBC World News"
echo "      **************"
curl --silent "$URL" | grep -E '(title>|description>)' | \
  sed -n '4,$p' | \
  sed -e 's/<title>//' -e 's/<\/title>//' -e 's/<description>/   /' \
      -e 's/<\/description>//' | \
  sed -e 's/<!\[CDATA\[//g' |           
  sed -e 's/\]\]>//g' |        
  sed -e 's/<[^>]*>//g' |     
  head $headarg | sed G | fmt

No comments:

Post a Comment