metapage 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metapage/version.rb +1 -1
- data/lib/metapage.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1224345899cff60c51e9fe1051caa6d2c65d55b
|
4
|
+
data.tar.gz: be3eb9eb0b8f637e1560f3bb2f5d5651f399fc75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d78e1d04e3bd6068b21f1efbd79d49d672d4e7bf371f73a3c267ac6475ee4e6a2c6d98a9fa456f94823a8a118a4b71650d4e8b350aab676cad3a473d51b8a250
|
7
|
+
data.tar.gz: acb13a35c999c9381d04c0619d005bc9354a427e8b1465d02278ce70d0d89491d93425537866a4b5e5bf25c6bec7191e47efdbf5f9901b968af8dc20f747675e
|
data/lib/metapage/version.rb
CHANGED
data/lib/metapage.rb
CHANGED
@@ -25,11 +25,18 @@ module Metapage
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def extract(text)
|
28
|
-
|
28
|
+
extract_urls(text).map {|url| fetch(url.gsub(/[\.\,]+\Z/, '')) }.compact
|
29
29
|
end
|
30
30
|
|
31
31
|
def extract!(text)
|
32
|
-
|
32
|
+
extract_urls(text).map {|url| fetch!(url.gsub(/[\.\,]+\Z/, '')) }.compact
|
33
|
+
end
|
34
|
+
|
35
|
+
def extract_urls(text)
|
36
|
+
processed_text = text.
|
37
|
+
gsub(/([^\/])www\./, '\1http://www.').
|
38
|
+
gsub(/\Awww\./, 'http://www.')
|
39
|
+
URI.extract processed_text, ['http', 'https']
|
33
40
|
end
|
34
41
|
end
|
35
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metapage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoph Olszowka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|