Skip to content

Instantly share code, notes, and snippets.

@lyoshenka
Last active December 19, 2015 00:18
Show Gist options
  • Save lyoshenka/5867324 to your computer and use it in GitHub Desktop.
Save lyoshenka/5867324 to your computer and use it in GitHub Desktop.
Downloads the entire history of all of your feeds on Google Reader. Data is formatted in JSON, just the way Google Reader uses it. The data for each feed is placed in its own file.
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: $0 /path/to/your/subscriptions.xml"
exit 1
fi
grep -o 'xmlUrl="[^"]\+' "$1" | cut -d'"' -f2 | while read FEED; do
FEED_URL="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$FEED")"
URL="https://www.google.com/reader/api/0/stream/contents/feed/${FEED_URL}?r=n&n=99999"
FILENAME=$(echo -n "$FEED" | sed -e 's|https\?://\(www\.\)\?||' -e 's|[/.]|_|g' -e 's|_\+$||g')
echo -e "$FEED\n=> $FILENAME"
curl -s -L $URL | tr -d '\n' > $FILENAME
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment