Fixed Typos
This commit is contained in:
parent
8392bace0e
commit
95f9200362
10
news/news
10
news/news
|
@ -67,7 +67,7 @@ getNews()
|
|||
tag=$( echo $* | sed s/\ /\%20/g )
|
||||
info=$(httpGet "http://beta.newsapi.org/v2/everything?q=$tag&apiKey=5d02fa1a64b24a25ac426594e986500a&language=en") > /dev/null #grab the JSON response
|
||||
export PYTHONIOENCODING=utf8 #necessary for python in some cases
|
||||
echo $info | python -c "import sys, json; print json.load(sys.stdin)['status']" > /dev/null 2>&1 || { echo "Not a valid news tag"; exit 1; } #checking if we get any information back from the server if not chances are it isnt a valid stock symbol
|
||||
echo $info | python -c "import sys, json; print json.load(sys.stdin)['status']" > /dev/null 2>&1 || { echo "Not a valid news tag"; exit 1; } #checking if we get any information back from the server if not chances are it isnt a valid tag
|
||||
# The rest of the code is just extrapolating the data with python from the JSON response
|
||||
title=$(echo $info | python -c "import sys, json; print json.load(sys.stdin)['articles'][0]['title']")
|
||||
author=$(echo $info | python -c "import sys, json; print json.load(sys.stdin)['articles'][0]['author']")
|
||||
|
@ -138,13 +138,13 @@ usage()
|
|||
cat <<EOF
|
||||
News
|
||||
Description: Brings you the latest headline from a tag
|
||||
Usage: stocks [flag] or stocks [tag]
|
||||
Usage: news [flag] or news [tag]
|
||||
-u Update Bash-Snippet Tools
|
||||
-h Show the help
|
||||
-v Get the tool version
|
||||
Examples:
|
||||
stocks Google
|
||||
stocks Donald Trump
|
||||
news Google
|
||||
news Donald Trump
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ elif [[ $# == "0" ]]; then
|
|||
exit 0
|
||||
else
|
||||
checkInternet || exit 1
|
||||
getNews $* # based on the stock symbol exrapolated by the getTicker function get information on the stock
|
||||
getNews $*
|
||||
printNews # print this information out to the user in a human readable format
|
||||
exit 0
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue