Bahwa nge-blog di blogspot atau blogger menyediakan fasilitas built-in bagi pengunjung kita untuk membaca update blog kita dengan menggunakan fasilitas RSS, so seringkali juga hal tersebut kita gunakan untuk mendaftarkan blog kita di beberapa search engine terkemukan, fasilitas tersebut terletak di URL http://yourblog.blogspot.com/feeds/posts/default.
dan ternyata bash pun bisa untuk membaca Feeds... ini scriptnya...
#!/bin/bash
declare -i count
ver=0.4
choise=endless
browser=none
#
# RDF/RSS reader
#
# Pretty lame actualy..
# Could have used some functions instead of c-and-p
# Might make it to smallest rdf/rss reader
# For updates check http://etv.cx/~the_jinx/rssread
#
# Anne Jan Brouwer (the_JinX)
# last edited 2004-05-15
echo "rss reader $ver"
echo
# usage
if [[ -z $1 || $1 == "--help" ]]; then
echo "usage: $0 url (browser)"
echo "will use elinks, links, lynx or a fallback;"
echo "if no browser set.."
exit
fi
# make tempfile
if [[ -e `which tempfile` ]]; then
tempfile=$(tempfile -p rss)
else
tempfile="/tmp/rssread"
touch $tempfile
fi
# download
wget $1 -O $tempfile
if [[ $? != 0 ]]; then
echo "wget error or wget not installed"
rm $tempfile
exit
fi
# shave titles
cat $tempfile | grep "<title>" | cut -d ">" -f 2 | cut -d "<" -f 1 > $tempfile"title"
# shave url
cat $tempfile | grep "<link>" | cut -d ">" -f 2 | cut -d "<" -f 1 > $tempfile"link"
# count links and titles
titles=$( wc -l $tempfile"title" | cut -d " " -f 1 )
links=$( wc -l $tempfile"link" | cut -d " " -f 1 )
if [[ $titles == 0 || $urls == 0 ]]; then
echo "no good.."
rm $tempfile*
exit
fi
# check if titles match urls
if [[ $titles -gt $links ]]; then
echo "more titles then links"
fi
if [[ $titles -lt $links ]]; then
echo "less titles then links"
fi
# The MAIN Loop
while [[ $choice != "" || $choice != 0 ]]; do
clear
# show title
echo "rss reader $ver"
echo "reading $1"
echo
# list items
count=1
while [[ $count -lt $titles ]]; do
# print titles
line=$( cat $tempfile"title" | head -n $count | tail -n 1 )
printf "%s\t" $count
echo $line
count=$count+1
done
# ask
echo
echo "Which would you like to read ?"
echo "0, q and x quit."
read choice
choice=$( echo $choice | tr A-Z a-z )
until [[ $choice != "" && $choice -gt 0 && $choice -le $titles ]]; do
if [[ $choice == 0 || $choice == "q" || $choice == "x" ]]; then
echo "bye.."
rm $tempfile*
exit
else
echo "BURP"
fi
read choice
choice=$( echo $choice | tr A-Z a-z )
done
# get link
link=$( cat $tempfile"link" | head -n $choice | tail -n 1)
link=${link//&/&}
#link=${link//&/%26}
# browser
if [[ -e $( which lynx 2> /dev/null ) ]]
then
browser=lynx
fi
if [[ -e $( which links 2> /dev/null ) ]]
then
browser=links
fi
if [[ -e $( which elinks 2> /dev/null ) ]]
then
browser=elinks
fi
if [[ $2 != "" ]]; then
if [[ -e $( which $2 2> /dev/null ) ]]
then
browser=$2
else
echo "$2 does not seem to be a browser :("
fi
fi
# showtime
if [[ $browser == none ]]; then
if [[ -e $( which sed ) ]]; then
wget -q -O - $link | sed -e 's/<.*>//' | sed -e '/^$/d' | less
else
wget -q -O - $link | less
fi
else
$browser "$link"
if [[ $? != 0 ]]; then
echo "browser error"
read -s -n1
fi
fi
done
#remove tempfiles
rm $tempfile*
#EOF
agak sulit memang untuk menjalankannya....!!! :P
Post a Comment
Bannerad
Artikel Terpopuler
-
Despite that at the end of this post you will find a filtered and somehow manually edited list of Pligg-based social bookmarking sites, this...
-
2016-08-09 18:38:19.0 Guangzhou Int'l Parcel Center received 2016-08-09 18:38:25.0 Guangzhou Int'l Parcel Center customs scan 20...
-
It seems the method for us to use is far simpler than my initial impressions - we need only add two small sections of code to our templates ...
-
Disaat-saat tertentu untuk menghilangkan kejenuhan kadang kala entertain (kesenangan) harus kita upayakan, demikian pula ketika kita berkuta...
-
Last month we showed you some of the more popular and useful Adobe AIR applications (see " 6 Adobe AIR Apps to Check Out &quo...
-
PicPick is an all-in-one software for software developers, graphic designers and home user. It has an intuitive interface and simple, elega...
-
About the author henkhei is man in the mirror where you can find everywhere henkhei . he specializes in topics of interest to techno gee...
-
Twitter pages have their own google page rank too in Google, so it is important to do that 5 mins drill better utilize your Twitter page.Thi...
-
A tablet PC is a wireless, portable personal computer with a touch screen interface. The tablet form factor is typically smaller than ...
-
Bio-Linux is an ideal system for scientists handling and analysing biological data. Bio-Linux 6.0 is a fully featured, powerful, config...
Tags
Blogumulus by Roy Tanck and Amanda Fazani