Created
October 30, 2014 01:17
-
-
Save somerandomnerd/1321f65f6af9ad10205e to your computer and use it in GitHub Desktop.
A simple shell script to stick into Automator, to take a plain text URL, get the title from the web page, and turn it into a Markdown link. Requires the Nokogiri gem to be installed.
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
require 'open-uri' | |
require 'nokogiri' | |
ARGF.each do |f| | |
doc = Nokogiri::HTML(open(f)) | |
print "[" + doc.at_css("title").content.gsub(/\s{2,}/, "") + "]" + "(" + f.strip + ")" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment