class Tychus::Parsers::FoodNetworkParser

Public Class Methods

uri_host() click to toggle source
# File lib/tychus/parsers/food_network_parser.rb, line 4
def self.uri_host
  "foodnetwork.com"
end

Public Instance Methods

parse_author() click to toggle source
# File lib/tychus/parsers/food_network_parser.rb, line 8
def parse_author
  # in the case of an author advertising her TV show
  # TODO: test case where the author is _not_
  itemprop_node_for(:author)
    .css('span')
    .first
    .content
end
parse_description() click to toggle source
# File lib/tychus/parsers/food_network_parser.rb, line 17
def parse_description
  # Foodnetwork does not use the description in its recipe body
  # resort to opengraph to pull out description in head
  # TODO: pull this func out for an opengraph parser?
  @doc.css('meta[property="og:description"]').first.attr('content')
end
parse_ingredients() click to toggle source
# File lib/tychus/parsers/food_network_parser.rb, line 24
def parse_ingredients
  recipe_doc
    .css('[itemprop="ingredients"]')
    .map { |node| node.content.lstrip.squeeze(" ").chomp } 
end