Created
August 11, 2012 18:10
-
-
Save kristianfreeman/3326086 to your computer and use it in GitHub Desktop.
Export into my Day One format for App.net posts
This file contains hidden or 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
require 'json' | |
require 'date' | |
json = File.read('appnet.json') | |
parsed = JSON.parse(json) | |
f = File.new("dayoneappdotnet.txt", "a") | |
parsed["posts"].each { | |
|elem| | |
# puts elem["text"] | |
date = DateTime.parse(elem["created_at"]) | |
text = <<-eos | |
* [[#{date.strftime('%I:%M')}](https://alpha.app.net/#{elem["user"]["username"]}/post/#{elem["id"]})] #{elem["text"]} | |
eos | |
f << text | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment