Skip to content

Instantly share code, notes, and snippets.

@jmorahan
Created February 9, 2015 18:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmorahan/56665898413fbb45212f to your computer and use it in GitHub Desktop.
Save jmorahan/56665898413fbb45212f to your computer and use it in GitHub Desktop.
NewsBlur saved stories download
#!/bin/bash
# Log in. Substitute your own username and password here.
echo "Logging in..."
curl --cookie-jar cookies -d username=somebody -d password='secret' https://www.newsblur.com/api/login >/dev/null
PAGE=0
while
# Download the next page of saved stories.
PAGE=$(($PAGE + 1))
echo "Downloading saved stories, page ${PAGE}..."
curl --cookie cookies https://www.newsblur.com/reader/starred_stories?page=$PAGE > saved-stories.${PAGE}.json
# Count how many stories we got back (requires http://kmkeen.com/jshon/)
(($(jshon -e stories -l < saved-stories.${PAGE}.json)))
do :; done
# tidy up by removing the last (empty) page of stories, and the cookie jar
rm -f cookies saved-stories.${PAGE}.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment