nsbin/get_news-v0.2

52 lines
1.2 KiB
Groff
Raw Normal View History

2006-07-20 07:54:37 +00:00
#!/bin/sh
#
# Nico Schottelius <nico@schottelius.(net|org)>
# Date: 25-May-2004
# Last Modified:
# Get only the latest headlines from different news sites
#
BASE_DIR=~/.get_news
TMP=/tmp/$$-$UID-`date +%s`
if [ $# -ne 1 ]; then
echo "Go away. I want one argument."
exit 666
fi
USERFILE="$BASE_DIR/$1"
case "$1" in
heise)
RDF=http://www.heise.de/newsticker/heise.rdf
BEGIN_NEWS='<title>'
END_NEWS='<\/title>'
NEWS_NAME="heise online news"
;;
pro-linux)
RDF=http://www.heise.de/newsticker/heise.rdf
BEGIN_NEWS='<title>'
END_NEWS='<\/title>'
NEWS_NAME="Pro-Linux News"
;;
*)
"Go away. I don't know anything about $1."
exit 23
esac
SED_STRING='/'"$BEGIN_NEWS"'/{s/'"$BEGIN_NEWS"'//g;s/'"$END_NEWS"'//g;q};d'
echo $SED_STRING
# get
#curl -s "$RDF"
#curl -s "$RDF" | sed "$SED_STRING"
curl -s "$RDF" | grep "$BEGIN_NEWS" | grep -v "$NEWS_NAME" | sed -e "s/$BEGIN_NEWS//g" -e "s/$END_NEWS//g"
#if [ ! -f "$USERFILE" ]; then
# cat "$TMP"
#else
# diff -u "$USERFILE" "$TMP" | grep ^+ | grep -v ^+++ | sed 's/^+/Heise News: /g' 2>/dev/null
#fi
#
###mv -f "$TMP" "$USERFILE" || rm -f "$TMP"