Skip to content

Instantly share code, notes, and snippets.

@klickreflex
Last active June 4, 2020 08:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klickreflex/3ab6425a34a25bbfba621f66c3d63220 to your computer and use it in GitHub Desktop.
Save klickreflex/3ab6425a34a25bbfba621f66c3d63220 to your computer and use it in GitHub Desktop.
Import Instagram Export to Day One Journal (requires the Day One CLI tool)
require 'json'
file = File.read('media.json')
data_hash = JSON.parse(file)
photos = data_hash['photos']
i = 0
photos.each do |key, value|
date = key['taken_at']
path = key['path']
if key['caption'].to_s.empty?
caption = ' '
else
caption = key['caption']
end
i += 1
puts caption
importToDayOne = `dayone2 new -p #{path} -isoDate=#{date} -z=Europe/Berlin -j=Instagram "#{caption}"`
if $?.success?
puts importToDayOne
else
abort 'error: could not execute command'
end
puts i
end
@klickreflex
Copy link
Author

Switched to ruby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment