boilerpipe 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/boilerpipe.gemspec +2 -2
- data/lib/boilerpipe.rb +6 -6
- metadata +4 -4
data/boilerpipe.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "boilerpipe"
|
3
|
-
s.version = "0.0.
|
4
|
-
s.date = "2010-05-
|
3
|
+
s.version = "0.0.2"
|
4
|
+
s.date = "2010-05-15"
|
5
5
|
s.summary = "Ruby wrapper of the Boilerpipe API"
|
6
6
|
s.email = "g.marcilhacy@gmail.com"
|
7
7
|
s.homepage = "https://github.com/gregorym/boilerpipe"
|
data/lib/boilerpipe.rb
CHANGED
@@ -11,14 +11,14 @@ class Object
|
|
11
11
|
end
|
12
12
|
|
13
13
|
module Boilerpipe
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
BP_DEFAULT_API_URL = 'http://boilerpipe-web.appspot.com/extract'
|
15
|
+
BP_EXTRACTORS = [ :ArticleExtractor, :DefaultExtractor, :LargestContentExtractor, :KeepEverythingExtractor, :CanolaExtractor ]
|
16
|
+
BP_OUTPUT_FORMATS = [ :html, :htmlFragment, :text, :json, :debug ]
|
17
17
|
|
18
18
|
def self.extract(extract_url, opts = {})
|
19
|
-
@output = opts[:output].present? ? opts[:output] :
|
20
|
-
@extractor = opts[:extractor].present? ? opts[:extractor] :
|
21
|
-
@api = opts[:api].present? ? opts[:api] :
|
19
|
+
@output = opts[:output].present? ? opts[:output] : BP_OUTPUT_FORMATS.first
|
20
|
+
@extractor = opts[:extractor].present? ? opts[:extractor] : BP_EXTRACTORS.first
|
21
|
+
@api = opts[:api].present? ? opts[:api] : BP_DEFAULT_API_URL
|
22
22
|
|
23
23
|
url = [@api, "?url=#{extract_url}", "&extractor=#{@extractor}","&output=#{@output}"].join
|
24
24
|
open(url).read
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boilerpipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Gr\xC3\xA9gory Marcilhacy"
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-05-
|
18
|
+
date: 2010-05-15 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|