forked from iancanderson/hangry
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from GoodMeasuresLLC/make_it_current
Update the gem for new rubies, new website formats
- Loading branch information
Showing
60 changed files
with
49,815 additions
and
40,137 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: ruby | ||
rvm: | ||
- 2.2.0 | ||
- 2.1.2 | ||
- 2.0.0 | ||
- 1.9.3 | ||
#- jruby-19mode # JRuby in 1.9 mode - disabled for now due to differences in JRuby Nokogiri results... | ||
- rbx-19mode |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class BigOvenParser < DataVocabularyRecipeParser | ||
def self.can_parse?(html) | ||
canonical_url_matches_domain?(html, 'bigoven.com') | ||
end | ||
|
||
def parse_ingredients | ||
nodes_with_itemprop(:ingredients).map do |i| | ||
i.content.strip | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class CopykatParser < SchemaOrgRecipeParser | ||
|
||
def self.can_parse?(html) | ||
canonical_url_matches_domain?(html, 'copykat.com') | ||
end | ||
|
||
def parse_author | ||
# => all from her? | ||
"Stephanie Manley via CopyKat.com" | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class Epicurious2Parser < SchemaOrgRecipeParser | ||
|
||
def self.can_parse?(html) | ||
canonical_url_matches_domain?(html, 'epicurious.com') && canonical_url_contains_path?(html,'recipes/member/views') | ||
end | ||
|
||
def parse_description | ||
recipe_ast.css("#recipeIntroText").css(".truncatedTextModuleText").first.content | ||
end | ||
|
||
def parse_ingredients | ||
# => ingredients are in the #ingredients div, separated by <br> | ||
recipe_ast.css("#ingredients").children.map do |node| | ||
if node.text.strip.blank? || node.text.strip.downcase == "ingredients" | ||
nil | ||
else | ||
node.text.strip | ||
end | ||
end.compact | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class EpicuriousParser < SchemaOrgRecipeParser | ||
|
||
def self.can_parse?(html) | ||
canonical_url_matches_domain?(html, 'epicurious.com') | ||
end | ||
|
||
def parse_ingredients | ||
recipe_ast.css(".ingredient").map(&:content) | ||
end | ||
|
||
def parse_instructions | ||
node_with_itemprop("recipeInstructions").css(">p").map(&:content).join("\n") | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class FoodNetworkParser < SchemaOrgRecipeParser | ||
|
||
def self.can_parse?(html) | ||
canonical_url_matches_domain?(html, 'foodnetwork.com') | ||
end | ||
|
||
def parse_instructions | ||
node_with_itemprop(:recipeInstructions).css("p").map(&:content).join("\n") | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class HomeCookingParser < SchemaOrgRecipeParser | ||
def self.can_parse?(html) | ||
!CanonicalUrlParser.new(html).canonical_url.nil? && CanonicalUrlParser.new(html).canonical_url.include?('homecooking.about.com') | ||
end | ||
|
||
def parse_description | ||
recipe_ast.css(".expert-content-text").first.content.strip | ||
end | ||
|
||
def parse_name | ||
node_with_itemprop("headline name").content | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class JamieOliverParser < HRecipeParser | ||
|
||
def self.can_parse?(html) | ||
html.include?('jamieoliver.com') | ||
end | ||
|
||
def parse_description | ||
recipe_ast.css(".instructions").css("i").first.content | ||
end | ||
|
||
def parse_instructions | ||
recipe_ast.css(".content").css(".instructions").map(&:content).join("\n") | ||
end | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module Hangry | ||
module Parsers | ||
module NonStandard | ||
class SouthernFoodParser < SchemaOrgRecipeParser | ||
|
||
def self.can_parse?(html) | ||
!CanonicalUrlParser.new(html).canonical_url.nil? && CanonicalUrlParser.new(html).canonical_url.include?('southernfood.about.com') | ||
end | ||
|
||
def parse_name | ||
node_with_itemprop("headline name").content | ||
end | ||
|
||
def parse_description | ||
recipe_ast.css(".expert-content-text").first.content.strip | ||
end | ||
|
||
def parse_instructions | ||
node_with_itemprop("recipeInstructions").css("li").map(&:content).join("\n") | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
|
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
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
Oops, something went wrong.