Last active
April 17, 2016 04:11
-
-
Save ericdwhite/5209338 to your computer and use it in GitHub Desktop.
Example using CURL to access https://www.newsblur.com/api
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
# | |
# To use this Makefile: | |
# 1. Change USER, PASSWORD | |
# | |
# 2. Login | |
# $ make login | |
# This creates a session file holding an API cookie (tmp/session.newsblur) | |
# | |
# 3. Downloads your feeds | |
# $ make feeds | |
# | |
# 4. Read the newsblur API: https://www.newsblur.com/api | |
# Working with JSON responses | |
# - most of the reponses are stored in the 'tmp' folder | |
# - use jshon to pretty print them | |
# e.g. $ cat tmp/feeds.json | jshon | vim - | |
# Change to your http://www.newsblur.com | |
# username and password | |
USER=newsblurUsername | |
PASSWORD=newsblurPassword | |
# | |
# Read the API | |
# https://www.newsblur.com/api | |
# | |
clean: | |
rm -fr tmp | |
login: clean | |
mkdir -p tmp | |
curl -X POST \ | |
-c tmp/session.newsblur \ | |
-d 'username=$(USER)&password=$(PASSWORD)' \ | |
https://www.newsblur.com/api/login | |
@echo | |
feeds: | |
curl -X GET \ | |
-b tmp/session.newsblur \ | |
https://www.newsblur.com/reader/feeds > tmp/feeds.json | |
cat tmp/feeds.json | |
@echo | |
# This is dependent on the output from tmp/feeds.json | |
# e.g. I selected feed id 847 from my own feeds. | |
# | |
# Then to see a story content | |
# $ cat tmp/stories.json | jshon -e stories -e 0 -e story_content -u | |
stories: | |
curl -X GET \ | |
-b tmp/session.newsblur \ | |
https://www.newsblur.com/reader/feed/847 > tmp/stories.json | |
cat tmp/stories.json | |
@echo | |
.PHONY: login feeds stories |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment