serious-eats 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/serious-eats/scraper.rb +20 -20
- data/lib/serious-eats/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c54ec7f20769cb7f5a66680f04005132bfd05fdd7d63a0945a35ecb650db842
|
|
4
|
+
data.tar.gz: 22550e2b9a4c135270ded6bdd5a36819d98979195424e0607a9b3bdd6b445b10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b4e5cbf17e1f9630647005efb5fda4a6a1f94a37df3545f0b70266e277687513b8261d1941d20f76a2318bd48777bad0c3cb1e9bb4ba16505777a426d608dc7
|
|
7
|
+
data.tar.gz: 06c8f523e2020d34cc227e5f0e6a9482d4d6e1328ec640a11df635bc79dac8d5094d0603b9c14823eed6c0a733a141722fcaba0da9a9b4486296e1d447430f93
|
data/Gemfile.lock
CHANGED
data/lib/serious-eats/scraper.rb
CHANGED
|
@@ -25,32 +25,32 @@ module SeriousEats
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def fetch_recipe_data(recipe)
|
|
28
|
-
get_recipe_data(recipe)
|
|
29
|
-
recipe.description = block.css(".recipe-introduction-body p:not(.caption)").map do |description|
|
|
30
|
-
description.text.strip
|
|
31
|
-
end.select do |description|
|
|
32
|
-
# some recipes have some empty <p> tags that need to be filtered out
|
|
33
|
-
description.length > 0
|
|
34
|
-
end
|
|
28
|
+
block = get_recipe_data(recipe)
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
recipe.description = block.css(".recipe-introduction-body p:not(.caption)").map do |description|
|
|
31
|
+
description.text.strip
|
|
32
|
+
end.select do |description|
|
|
33
|
+
# some recipes have some empty <p> tags that need to be filtered out
|
|
34
|
+
description.length > 0
|
|
35
|
+
end
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
recipe.portion = block.css("span.info.yield").text.strip
|
|
38
|
+
recipe.active_time = block.css("ul.recipe-about li:nth-child(2) span.info").text.strip
|
|
39
|
+
recipe.total_time = block.css("ul.recipe-about li:nth-child(3) span.info").text.strip
|
|
40
|
+
recipe.rating = block.css("span.info.rating-value").text.strip.to_f.round(1)
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
end
|
|
42
|
+
recipe.ingredients = block.css("li.ingredient").map do |ingredient|
|
|
43
|
+
text = ingredient.text.strip
|
|
47
44
|
|
|
48
|
-
|
|
45
|
+
if ingredient.css("strong").any?
|
|
46
|
+
text = "\n#{text.underline}"
|
|
49
47
|
end
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
text
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
recipe.directions = block.css(".recipe-procedure-text").map do |direction|
|
|
53
|
+
direction.text.strip
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
end
|
data/lib/serious-eats/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: serious-eats
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alisa Cookie McCormick
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-12-
|
|
11
|
+
date: 2018-12-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|