Skip to content

Instantly share code, notes, and snippets.

@betzerra
Last active December 29, 2017 02:04
Show Gist options
  • Save betzerra/74f97e4b8693f725aed56b5f60d04038 to your computer and use it in GitHub Desktop.
Save betzerra/74f97e4b8693f725aed56b5f60d04038 to your computer and use it in GitHub Desktop.
Querying Canillitapp with a little of shell scripting
# optional, I added some of my scripts at the bottom of my ~/.zshrc
# (I'm using oh-my-zsh https://github.com/robbyrussell/oh-my-zsh)
alias canillitapp_latest="~/Scripts/latest_news.sh"
alias canillitapp_popular="~/Scripts/popular_news.sh"
alias canillitapp_search="~/Scripts/search_news.sh"
alias canillitapp_trending="~/Scripts/trending_news.sh"
DATE=`date +%Y-%m-%d`
curl https://api.canillitapp.com/latest/$DATE | jq '.[0:20] | .[] | {title: .title, source: .source_name, url: .url, date : .date | strftime("%B %d %Y %I:%M%p %Z")}'
curl api.canillitapp.com/search/$1 | jq '.[0:20] | .[] | {title: .title, source: .source_name, date: .date | strftime("%B %d %Y %I:%M%p %Z"), url: .url}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment