Last active
December 29, 2017 02:04
-
-
Save betzerra/74f97e4b8693f725aed56b5f60d04038 to your computer and use it in GitHub Desktop.
Querying Canillitapp with a little of shell scripting
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
# 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" |
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
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")}' |
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
curl https://api.canillitapp.com/popular | jq '.[0:5] | .[] | {title: .title, source: .source_name, date: .date | strftime("%B %d %Y %I:%M%p %Z"), url: .url, reactions: .reactions}' |
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
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}' |
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
DATE=`date +%Y-%m-%d` | |
curl https://api.canillitapp.com/trending/$DATE/7 | jq '.news | to_entries[] | {"key": .key, "title": .value | .[0].title, "url": .value | .[0].url}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment