recipe_crawler 3.0.0 → 3.1.0
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/README.md +19 -1
- data/bin/recipe_crawler +31 -0
- data/lib/recipe_crawler/version.rb +1 -1
- data/recipe_crawler.gemspec +1 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93407c5d01cd73352cf65d4088cd809db0cafe52
|
4
|
+
data.tar.gz: 40e6ed45c7dbddcecc5263d39b0d861f2f6e176b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8711f60e8a64f9283938c6691db8b2a31e53739c4f15b7cedf0aeb05ebcbdbff1effccf180df3ab5e4e34f2ecd4507809015afddaa2e3b5d04b194c8752eb35d
|
7
|
+
data.tar.gz: 47668977e73a246b6b5ad5f65bf59ffcaacdccbac906cf2b6f4ecfaad641fb8c3906c8903d1a929224842f795d940b5154664b032c84c35838947ff59da11794
|
data/README.md
CHANGED
@@ -29,7 +29,25 @@ Or install it yourself as:
|
|
29
29
|
|
30
30
|
### Command line
|
31
31
|
|
32
|
-
|
32
|
+
Install this gem and run
|
33
|
+
|
34
|
+
$ recipe_crawler -h
|
35
|
+
Usage: recipe_crawler [options]
|
36
|
+
-n, --number x Number of recipes to fetch
|
37
|
+
-u, --url url URL of a recipe to fetch
|
38
|
+
|
39
|
+
So you just need to specify the first recipe url and the number of recipes wanted. Simple like this :
|
40
|
+
|
41
|
+
$ recipe_crawler -u http://www.cuisineaz.com/recettes/pate-a-pizza-legere-55004.aspx -n 8
|
42
|
+
[x] Pâte à pizza légère fetched!
|
43
|
+
[x] Pâtes au jambon cuit fetched!
|
44
|
+
[x] Oeufs au plat sucrés fetched!
|
45
|
+
[x] Pizza légère fetched!
|
46
|
+
[x] Vin cuit fetched!
|
47
|
+
[x] Tiramisu aux framboises simplissime et rapide fetched!
|
48
|
+
[x] Risotto aux champignons et au parmesan fetched!
|
49
|
+
[x] Gnocchi fetched!
|
50
|
+
|
33
51
|
|
34
52
|
### API
|
35
53
|
|
data/bin/recipe_crawler
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "recipe_crawler"
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
options = {
|
7
|
+
limit: 1,
|
8
|
+
url: nil
|
9
|
+
}
|
10
|
+
|
11
|
+
# Parse options
|
12
|
+
optparser = OptionParser.new do |opts|
|
13
|
+
opts.on("-n", "--number x", Integer, "Number of recipes to fetch") { |x| options[:number] = x}
|
14
|
+
opts.on("-u", "--url url", String, "URL of a recipe to fetch") { |x| options[:url] = x}
|
15
|
+
opts.parse!(ARGV)
|
16
|
+
end
|
17
|
+
|
18
|
+
# check if url is set
|
19
|
+
if options[:url]
|
20
|
+
|
21
|
+
# Instanciate the crawler
|
22
|
+
r = RecipeCrawler::Crawler.new options[:url]
|
23
|
+
|
24
|
+
# crawl and display recipe fetched
|
25
|
+
r.crawl!(options[:number]) do |recipe|
|
26
|
+
puts "[x] #{recipe.title} fetched!"
|
27
|
+
end
|
28
|
+
|
29
|
+
else
|
30
|
+
raise OptionParser::MissingArgument, 'You need to specify a start url.'
|
31
|
+
end
|
data/recipe_crawler.gemspec
CHANGED
@@ -16,8 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
-
spec.
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.executables = ['recipe_crawler']
|
21
20
|
spec.require_paths = ["lib"]
|
22
21
|
|
23
22
|
spec.add_dependency "recipe_scraper", '>= 2.2.0'
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recipe_crawler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- madeindjs
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -84,7 +84,8 @@ description: This crawler will use my personnal scraper named 'RecipeScraper' to
|
|
84
84
|
recipes data from Marmiton, 750g or cuisineaz
|
85
85
|
email:
|
86
86
|
- madeindjs@gmail.com
|
87
|
-
executables:
|
87
|
+
executables:
|
88
|
+
- recipe_crawler
|
88
89
|
extensions: []
|
89
90
|
extra_rdoc_files: []
|
90
91
|
files:
|
@@ -97,6 +98,7 @@ files:
|
|
97
98
|
- README.md
|
98
99
|
- Rakefile
|
99
100
|
- bin/console
|
101
|
+
- bin/recipe_crawler
|
100
102
|
- bin/setup
|
101
103
|
- lib/recipe_crawler.rb
|
102
104
|
- lib/recipe_crawler/crawler.rb
|