Skip to content

Instantly share code, notes, and snippets.

Created July 6, 2016 06:59
What would you like to do?
#!/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"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment