Topic: https://brettterpstra.com/2013/11/01/save-pocket-favorites-to-nvalt-with-ifttt-and-hazel/
hide preview

What's next? verify your email address for reply notifications!

node was disabled (waiting for deletion)

(waiting for deletion)

hide preview

What's next? verify your email address for reply notifications!

unverified 5y, 68d ago

INK for ALL made our process around publishing content to my static site so much speedier capability to export Markdown documentation. I can export Jekyll-compatible files as well

hide preview

What's next? verify your email address for reply notifications!

Panzerboy 11y, 134d ago

Weird, the recipe is never triggered for me. Don't know exactly why ...

hide preview

What's next? verify your email address for reply notifications!

ErgoOrgo 11y, 138d ago

I do something similar but in a single step: I have an IFTTT recipe that runs the Pocket favorite through your heckyesmarkdown.com service to save the file directly where I want. The pro is that it all happens online, but the con is that I have to save tags in the filename, not as native osx tags.

hide preview

What's next? verify your email address for reply notifications!

lamike 11y, 139d ago

Brent…

Sorry to bother. Having trouble compiling this script. I made but one change. I removed the "'s around target file entry since my nvALT notes reside in dropbox with a folder name identical to yours. Hazel tells me I have a missing field. Here's what I am trying to run

#!/usr/bin/env ruby

# Works with IFTTT recipe https://ifttt.com/recipes/1...

#

# Set Hazel to watch the folder you specify in the recipe.

# Make sure nvALT is set to store its notes as individual files.

# Edit the $target_folder variable below to point to your nvALT

# ntoes folder.

require 'date'

require 'open-uri'

require 'net/http'

require 'fileutils'

require 'cgi'

$target_folder = ~/Dropbox/nvALT2.2/

def url_to_markdown(url)

res = Net::HTTP.post_form(URI.parse("http://heckyesmarkdown.com/go/"),{'u'=>url,'read'=>'1'})

if res.code.to_i == 200

res.body

else

false

end

end

file = ARGV[0]

begin

input = IO.read(file).force_encoding('utf-8')

headers = {}

input.each_line {|line|

key, value = line.split(/: /)

headers[key] = value.strip || ""

}

outfile = File.join(File.expand_path($target_folder), headers['Title'].gsub(/["!*?'|]/,'') + ".md")

date = Time.now.strftime("%Y-%m-%d %H:%M")

date_added = Date.parse(headers['Date']).strftime("%Y-%m-%d %H:%M")

content = "Title: #{headers['Title']}\nDate: #{date}\nDate Added: #{date_added}\nSource: #{headers['URL']}\n"

tags = false

if headers['Tags'].length > 0

tag_arr = headers['Tags'].split(", ")

tag_arr.map! {|tag|

%Q{"#{tag.strip}"}

}

tags = tag_arr.join(" ")

content += "Keywords: #{tags}\n"

end

markdown = url_to_markdown(headers['URL']).force_encoding('utf-8')

if markdown

content += headers['Image'].length > 0 ? "\n\n![](#{headers['Image']})\n\n#{markdown}\n" : "\n\n"+markdown

else

content += headers['Image'].length > 0 ? "\n\n![](#{headers['Image']})\n\n#{headers['Excerpt']}\n" : "\n\n"+headers['Excerpt']

end

File.open(outfile,'w') {|f|

f.puts content

}

if tags && File.exists?("/usr/local/bin/openmeta")

%x{/usr/local/bin/openmeta -a #{tags} -p "#{outfile}"}

end

FileUtils.rm(file)

rescue Exception => e

puts e

end

remark link
hide preview

What's next? verify your email address for reply notifications!

ttscoff 11y, 139d ago

Put quotes around the path in $target_folder. Let me know if that fixes it.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

lamike 11y, 139d ago

That did it. Learned something. THANK YOU!

hide preview

What's next? verify your email address for reply notifications!