Created
July 9, 2014 20:16
-
-
Save jaytaylor/29a7bfab0730c84de13d to your computer and use it in GitHub Desktop.
Get all your saved stories from HN
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
#!/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