Skip to content

Instantly share code, notes, and snippets.

@darkerego
Created November 13, 2017 22:11
Show Gist options
  • Save darkerego/443c1bd355642ac164789e73032520e7 to your computer and use it in GitHub Desktop.
Save darkerego/443c1bd355642ac164789e73032520e7 to your computer and use it in GitHub Desktop.
massmine.sh
#!/bin/bash
# Just a wrapper for massmine queries.
# DarkEgo November, 2017
# check depends
which massmine >/dev/null 2>&1 || { echo "Error! Massmine is not in system PATH. Please configure and try again!" ; exit 1 ; }
which jq >/dev/null 2>&1 || { echo 'Error! Please install the package `jq` <debx: apt update;apt -y install jq>' ; exit 1 ; }
# other stuff we need
if [[ ! -d "/home/$USER/mine" ]] ; then
echo 'Creating directory ~/mine ... '
mkdir -p "/home/$USER/mine"
fi
RIGHT_NOW=$(date +"%h.%d-%S")
output="data.$RIGHT_NOW"
case "$1" in
-m|--mine)
query="$2"
count=${3:-"200"}
cd /home/$USER/mine
massmine --task=twitter-search --count="$count" --query="$query" > "$output"
cat "$output" | jq .text
;;
*)
echo 'Usage: $0 <query> <count>'
echo 'See docs at http://www.massmine.org/docs/config.html '
;;
esac
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment