Created
July 6, 2016 06:59
-
-
Save labocho/a93a5951d264c395b55177db3dd22af3 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# Kobito の JSON-LD を受け取って、#{timestamp}_#{title}.md のファイルを生成する | |
# Example: cat ~/Dropbox/Kobito/Kobito\ Archive/*.json | jq -c . | kobito-export | |
require "json" | |
require "time" | |
while line = gets | |
json = JSON.parse(line) | |
updated_at = Time.parse(json["updated_at"]) | |
filename = updated_at.strftime("%Y%m%d%M%H%S") + "_" + json["title"] + ".md" | |
filename.gsub!("/", "-") | |
File.write(filename, json["raw_body"]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment