cookler 0.2.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cookler.rb +6 -6
- metadata +2 -2
data/lib/cookler.rb
CHANGED
@@ -5,19 +5,19 @@ require 'cookler/utils'
|
|
5
5
|
|
6
6
|
class Cookler
|
7
7
|
|
8
|
-
def initialize(targets, max_results=nil)
|
8
|
+
def initialize(targets, max_results=nil, dbURI=nil, anemone_db_uri=nil)
|
9
9
|
@targets = targets
|
10
10
|
@max_results = (max_results.nil? ? 15 : max_results)
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@db = (dbURI.nil? ? Mongo::Connection.new().db('cookler-db') : Mongo::Connection.from_uri(dbURI).db('cookler-db'))
|
12
|
+
@anemone_db = (anemone_db_uri.nil? ? nil : Mongo::Connection.from_uri(anemone_db_uri).db('anemone'))
|
13
13
|
@pages = @db['pages']
|
14
14
|
@stats = @db['stats']
|
15
15
|
@depth_limit = 3
|
16
16
|
@threads = []
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.analyze(targets, max_results=nil)
|
20
|
-
cookler = self.new(targets, max_results)
|
19
|
+
def self.analyze(targets, max_results=nil, dbURI=nil, anemone_db_uri=nil)
|
20
|
+
cookler = self.new(targets, max_results, dbURI, anemone_db_uri)
|
21
21
|
cookler.run
|
22
22
|
end
|
23
23
|
|
@@ -52,7 +52,7 @@ class Cookler
|
|
52
52
|
words = []
|
53
53
|
|
54
54
|
anemone = Anemone::Core.new(target[1][0], {:depth_limit => @depth_limit})
|
55
|
-
anemone.storage = Anemone::Storage.MongoDB
|
55
|
+
anemone.storage = Anemone::Storage.MongoDB(@anemone_db)
|
56
56
|
anemone.focus_crawl do |page|
|
57
57
|
if nbResults == @max_results
|
58
58
|
anemone.kill_threads
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-09-22 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! " Cookler is a Ruby library that provides spidering and analysing
|
15
15
|
features.\n It helps you to quickly write a program to retrieve content and statistics
|