Last active
June 4, 2020 08:41
-
-
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)
This file contains 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' | |
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 |
Switched to ruby.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instagram
inside the Day One appruby import.rb
)