Skip to content

Instantly share code, notes, and snippets.

@jaytaylor
Created July 9, 2014 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaytaylor/29a7bfab0730c84de13d to your computer and use it in GitHub Desktop.
Save jaytaylor/29a7bfab0730c84de13d to your computer and use it in GitHub Desktop.
Get all your saved stories from HN
#!/usr/bin/env bash
username='YOUR_HN_USERNAME'
cookie='user=HN_AUTH_COOKIE'
next="saved?id=${username}"
while ! [[ -z "${next}" ]]; do
echo "next=${next}"
next=$(curl "https://news.ycombinator.com/${next}" \
-H 'accept-encoding: gzip,deflate,sdch' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36' \
-H "cookie: ${cookie}" \
--compressed \
--silent | tee -a out.html | grep --only-matching 'x?fnid=[^"]\+')
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment