Created
January 31, 2013 02:06
-
-
Save dpick/4679320 to your computer and use it in GitHub Desktop.
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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
doc = Nokogiri::HTML(open(ARGV[0])) | |
title = doc.css('title').first.content.scan(/\r\n\t(.*) -/).first | |
puts title | |
image = doc.css('img#imgPhoto').first.attributes['src'].value | |
image_title = doc.css('img#imgPhoto').first.attributes['title'].value | |
ingredients = doc.css('#liIngredient').map { |e| e.content.strip.gsub(/\r\n +/, ' ') } | |
directions = doc.css('.directLeft li').map { |e| e.content } | |
puts "### Source" | |
puts "[AllRecipes](#{ARGV[0]})" | |
puts "" | |
puts '### Ingredients' | |
ingredients.each do |ingredient| | |
puts "* #{ingredient}" | |
end | |
puts "" | |
puts "### Directions" | |
directions.each do |direction| | |
puts "* #{direction}" | |
end | |
puts '' | |
puts "### Pictures" | |
puts "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment