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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1224345899cff60c51e9fe1051caa6d2c65d55b
4
- data.tar.gz: be3eb9eb0b8f637e1560f3bb2f5d5651f399fc75
3
+ metadata.gz: 05cb93187c38e33acf951f836cef6468ab769cb3
4
+ data.tar.gz: 05db56e92631abbf084b1a1ce3cba447dc330777
5
5
  SHA512:
6
- metadata.gz: d78e1d04e3bd6068b21f1efbd79d49d672d4e7bf371f73a3c267ac6475ee4e6a2c6d98a9fa456f94823a8a118a4b71650d4e8b350aab676cad3a473d51b8a250
7
- data.tar.gz: acb13a35c999c9381d04c0619d005bc9354a427e8b1465d02278ce70d0d89491d93425537866a4b5e5bf25c6bec7191e47efdbf5f9901b968af8dc20f747675e
6
+ metadata.gz: 28d3711d801935dc0387f347a3fe80fd99f0c4068c2595ec118127ddbc830947179c20ecfba27e6d622fc8ce2b769da1c5606442212283c8e089e611e20252c8
7
+ data.tar.gz: 0df60681d2d9e4eb5c4869c5b20f9759cb73ec84e208bbee06526e3070106751e3809a7a681aa9e3ffacb645a79e7675752496ffe73b22d5870264812de3a63b
@@ -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
- ERROR_CLASSES = [ResolveError, HTTPResponseError, ContentTypeError]
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
 
@@ -1,3 +1,3 @@
1
1
  module Metapage
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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: 2015-11-24 00:00:00.000000000 Z
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.4.5.1
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: