aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-10-28 15:15:38 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-10-28 15:15:38 -0200
commitf1ddb8d2ef435a7f3dc2996df529becd634267dd (patch)
tree2417006ee35b6720ca1d3ba7220b1be60694cfb8
parentc6fc17b2400dde2a1c8dd4d066fa4e1506ead4c0 (diff)
downloadhttruta-f1ddb8d2ef435a7f3dc2996df529becd634267dd.tar.gz
httruta-f1ddb8d2ef435a7f3dc2996df529becd634267dd.tar.bz2
Support for getting URLs from file
-rwxr-xr-xhttracker24
1 files changed, 18 insertions, 6 deletions
diff --git a/httracker b/httracker
index 7fc33c1..f899f06 100755
--- a/httracker
+++ b/httracker
@@ -6,13 +6,25 @@
# Load and initialize
source `dirname $0`/lib/httracker/functions || exit 1
-# Get URLs from feed
-# Thanks http://stackoverflow.com/questions/443991/how-to-parse-rss-feeds-xml-in-a-shell-script
-curl -s "$FEED" | grep -o '<link>[^<]*' | grep -o "[^>]*$" > $URLS
+# Parameters
+BASENAME="`basename $0`"
+FILE="$1"
-if [ "$?" != "0" ]; then
- echo "Error downloading feed $FEED, aborting."
- exit 1
+# Grab item list
+if [ -z "$FILE" ]; then
+ # Get URLs from feed
+ # Thanks http://stackoverflow.com/questions/443991/how-to-parse-rss-feeds-xml-in-a-shell-script
+ curl -s "$FEED" | grep -o '<link>[^<]*' | grep -o "[^>]*$" > $URLS
+
+ if [ "$?" != "0" ]; then
+ echo "Error downloading feed $FEED, aborting."
+ exit 1
+ fi
+elif [ -e "$FILE" ]; then
+ # Get URLs from file
+ cat $FILE > $URLS
+else
+ echo "usage: $BASENAME [file]"
fi
# Iterate over all URLs