recipe_crawler 2.1.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a08ccb046d6fcc71e07e3f232e0e62b3f7298224
4
- data.tar.gz: 472292684fa8ed1f27df25dfeea003a92489b284
3
+ metadata.gz: 89724169688d20b40e62c446b5aabada46cff9d5
4
+ data.tar.gz: 0f04b9336ccbbac34b7a03e984818b3ac83d1ba3
5
5
  SHA512:
6
- metadata.gz: 4c292442813ea2a0ae37400641b0bd9d98a9db25a4e22164c1f546e592c6946aecc3f3a3dcaf52236db36694ad36ecb4fb8b5da0c05e6b3945115ecb59902797
7
- data.tar.gz: 19d6862ab5faaa1c5b7812ba864ca69529bf59951d33578ac1eb8c28d09628c4ee9f1b1027118ffc9e98173fb176bdab0b03accc43276dd5c4d6d5ad26ad94c6
6
+ metadata.gz: 637f23b5a4bb49f48f4269009fcaec4155fae268c9cd4dbe65494f6048b745d6e6e99eef075ac232b9688078de169bffb5df17359a0b736682af64ccd4999c61
7
+ data.tar.gz: 5a2e5f744823dc0438be65741985b0b2d2c2466694590c30886f71e4c039eca5d1aa4698c5d38ffbdab7fa260fb0deb95fe22cfcc1efd944c313b37d8ab01928
data/README.md CHANGED
@@ -1,10 +1,6 @@
1
1
  # RecipeCrawler
2
2
 
3
- A web scrawler to get recipe data just by its web url: **RecipeCrawler** support:
4
-
5
- * [marmiton.org](http://www.marmiton.org/)
6
- * [750g.com](http://www.750g.com)
7
- * [cuisineaz.com](http://www.cuisineaz.com)
3
+ A web scrawler to get a [Marmiton](http://www.marmiton.org/) or [750g](http://www.750g.com)*(two famous french cooking recipe websites)*!
8
4
 
9
5
  You'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/recipe_crawler`. To experiment with that code, run `bin/console` for an interactive prompt.
10
6
 
@@ -1,3 +1,3 @@
1
1
  module RecipeCrawler
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -14,8 +14,7 @@ module RecipeCrawler
14
14
  attr_reader :title, :preptime, :cooktime , :ingredients, :steps, :image
15
15
 
16
16
  MARMITON_HOST = {desktop: 'http://www.marmiton.org/', mobile: 'http://m.marmiton.org/'}
17
- G750_HOST = {desktop: 'http://www.750g.com'}
18
- CUISINEAZ_HOST = {desktop: 'http://www.cuisineaz.com/'}
17
+ G750_HOST = 'http://www.750g.com'
19
18
 
20
19
 
21
20
 
@@ -23,15 +22,13 @@ module RecipeCrawler
23
22
  #
24
23
  # @param url [String] representing an url from Marmiton or 750g website
25
24
  def initialize url
25
+
26
+ warn "[DEPRECATION] `RecipeCrawler` is deprecated. Please download & use `RecipeSraper` instead."
27
+
26
28
  if marmiton_host? url
27
29
  fetch_from_marmiton url
28
-
29
30
  elsif g750_host? url
30
31
  fetch_from_g750 url
31
-
32
- elsif cuisineaz_host? url
33
- fetch_from_cuisineaz url
34
-
35
32
  else
36
33
  raise ArgumentError, "Instantiation cancelled (Host not supported)."
37
34
  end
@@ -73,7 +70,6 @@ module RecipeCrawler
73
70
  return text
74
71
  end
75
72
 
76
-
77
73
  # test if url is from a valid marmiton.org host
78
74
  #
79
75
  # @param url [String] representing an url
@@ -88,16 +84,7 @@ module RecipeCrawler
88
84
  # @param url [String] representing an url
89
85
  # @return [Boolean] as true if coresponding to a valid url
90
86
  def g750_host? url
91
- return url.include? G750_HOST[:desktop]
92
- end
93
-
94
-
95
- # test if url is from a valid cuisineaz.com host
96
- #
97
- # @param url [String] representing an url
98
- # @return [Boolean] as true if coresponding to a valid url
99
- def cuisineaz_host? url
100
- return url.include? CUISINEAZ_HOST[:desktop]
87
+ return url.include? G750_HOST
101
88
  end
102
89
 
103
90
 
@@ -170,40 +157,6 @@ module RecipeCrawler
170
157
  raise ArgumentError, "Instantiation cancelled (ulr not from #{G750_HOST})."
171
158
  end
172
159
  end
173
-
174
-
175
- # fill object properties from a 750g url
176
- #
177
- # @param url [String] representing an url
178
- def fetch_from_cuisineaz url
179
- if cuisineaz_host? url
180
- page = Nokogiri::HTML(open(url).read)
181
- @title = page.css('#ficheRecette h1.fs36').text
182
-
183
- # get times
184
- @preptime = page.css('#ctl00_ContentPlaceHolder_LblRecetteTempsPrepa').text.to_i
185
- @cooktime = page.css('#ctl00_ContentPlaceHolder_LblRecetteTempsCuisson').text.to_i
186
-
187
-
188
- @steps = []
189
- page.css("#preparation span p.fs17").each { |step_node|
190
- @steps << sanitize(step_node.text)
191
- }
192
-
193
- @ingredients = []
194
- page.css("#ingredients ul li span").each { |ing_node|
195
- @ingredients << sanitize(ing_node.text)
196
- }
197
-
198
- begin
199
- @image = page.css('#shareimg').attr('src').to_s
200
- rescue NoMethodError => e
201
- end
202
-
203
- else
204
- raise ArgumentError, "Instantiation cancelled (ulr not from #{G750_HOST})."
205
- end
206
- end
207
160
 
208
161
  end
209
162
 
@@ -23,4 +23,10 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
25
  spec.add_development_dependency "nokogiri"
26
+
27
+ spec.post_install_message = <<-MESSAGE
28
+ ! The 'recipe_crawler' gem has been deprecated and has been replaced by 'recipe_scraper'.
29
+ ! See: https://rubygems.org/gems/recipe_scraper
30
+ ! And: https://github.com/madeindjs/recipe_scraper
31
+ MESSAGE
26
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recipe_crawler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - madeindjs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2016-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,7 +91,10 @@ homepage: https://github.com/madeindjs/recipe_crawler
91
91
  licenses:
92
92
  - MIT
93
93
  metadata: {}
94
- post_install_message:
94
+ post_install_message: |
95
+ ! The 'recipe_crawler' gem has been deprecated and has been replaced by 'recipe_scraper'.
96
+ ! See: https://rubygems.org/gems/recipe_scraper
97
+ ! And: https://github.com/madeindjs/recipe_scraper
95
98
  rdoc_options: []
96
99
  require_paths:
97
100
  - lib
@@ -107,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
110
  version: '0'
108
111
  requirements: []
109
112
  rubyforge_project:
110
- rubygems_version: 2.5.1
113
+ rubygems_version: 2.4.8
111
114
  signing_key:
112
115
  specification_version: 4
113
116
  summary: A web scrawler to get a Marmiton's or 750g recipe