Commits

Ben Wing committed 6527f75

First commit

Comments (0)

Files changed (6)

continental-us.locations

+locations=-124.7625,24.5210,-66.9326,49.3845
+locations=-180.0,-90.0,180.0,90.0

pull-continental-us-tweets

+#!/bin/sh
+
+# You should pass in one extra argument, the directory to store stuff into.
+DIR="`dirname $0`"
+$DIR/pull-tweets continental-us ${1+"$@"}

pull-global-tweets

+#!/bin/sh
+
+# You should pass in one extra argument, the directory to store stuff into.
+DIR="`dirname $0`"
+$DIR/pull-tweets global ${1+"$@"}
+#!/bin/sh
+
+# You should pass in one extra argument, the directory to store stuff into.
+DIR="`dirname $0`"
+$DIR/pull-tweets spritzer ${1+"$@"}
+#!/bin/sh
+
+DIR="`dirname $0`"
+
+TWEETAREA=$1
+ACCOUNT="`cat $DIR/$TWEETAREA.userpass`"
+PULLDIR=$2
+if [ -z "$PULLDIR" ]; then
+  echo "Need to specify directory to store tweets in as argument"
+  exit 1
+fi
+PREFIX=$PULLDIR/$TWEETAREA.tweets
+(
+while true; do
+  echo "Beginning retrieval of tweets for area $TWEETAREA ..."
+  echo -n "Current time is "
+  date
+  if [ "$TWEETAREA" = spritzer ]; then
+    curl --silent --show-error https://stream.twitter.com/1/statuses/sample.json -u$ACCOUNT |bzip2 >> $PREFIX.bzip2
+  else
+    curl --silent --show-error -d @$DIR/$TWEETAREA.locations https://stream.twitter.com/1/statuses/filter.json -u$ACCOUNT |bzip2 >> $PREFIX.bzip2
+  fi
+  echo "Ending retrieval of tweets for area $TWEETAREA, trying again after a delay ..."
+  echo -n "Current time is "
+  date
+  sleep 90
+done
+) 2>> $PREFIX.errors