Created
November 13, 2017 22:11
-
-
Save darkerego/443c1bd355642ac164789e73032520e7 to your computer and use it in GitHub Desktop.
massmine.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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