metapage 0.3.0 → 0.4.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.rb +12 -2
- data/lib/metapage/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05cb93187c38e33acf951f836cef6468ab769cb3
|
4
|
+
data.tar.gz: 05db56e92631abbf084b1a1ce3cba447dc330777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d3711d801935dc0387f347a3fe80fd99f0c4068c2595ec118127ddbc830947179c20ecfba27e6d622fc8ce2b769da1c5606442212283c8e089e611e20252c8
|
7
|
+
data.tar.gz: 0df60681d2d9e4eb5c4869c5b20f9759cb73ec84e208bbee06526e3070106751e3809a7a681aa9e3ffacb645a79e7675752496ffe73b22d5870264812de3a63b
|
data/lib/metapage.rb
CHANGED
@@ -11,7 +11,10 @@ module Metapage
|
|
11
11
|
class ResolveError < StandardError; end;
|
12
12
|
class HTTPResponseError < StandardError; end;
|
13
13
|
class ContentTypeError < StandardError; end;
|
14
|
-
|
14
|
+
class IgnoredTitleError < StandardError; end;
|
15
|
+
ERROR_CLASSES = [ResolveError, HTTPResponseError, ContentTypeError, IgnoredTitleError]
|
16
|
+
|
17
|
+
IGNORE_LIST = ["signup", "signin", "login", "anmeldung", "anmelden", "registration"]
|
15
18
|
|
16
19
|
class << self
|
17
20
|
def fetch(url)
|
@@ -49,7 +52,14 @@ module Metapage
|
|
49
52
|
|
50
53
|
def title
|
51
54
|
unless image?
|
52
|
-
@title ||= metatag_content('og:title') || html_content('title')
|
55
|
+
@title ||= (metatag_content('og:title') || html_content('title')).tap do |title|
|
56
|
+
if title
|
57
|
+
checked_title = title.downcase.gsub(' ', '')
|
58
|
+
if IGNORE_LIST.any? {|word| checked_title.include? word }
|
59
|
+
raise IgnoredTitleError
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
53
63
|
end
|
54
64
|
end
|
55
65
|
|
data/lib/metapage/version.rb
CHANGED
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.4.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:
|
11
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -176,10 +176,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.
|
179
|
+
rubygems_version: 2.5.1
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: Extract metadata about a given HTML url from open graph and regular meta
|
183
183
|
tags
|
184
184
|
test_files: []
|
185
|
-
has_rdoc:
|