website_information 0.5.9 → 0.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a9a5e4512000c12c0486a1d7f943439fdfa547
|
4
|
+
data.tar.gz: 30ca352dbd771d8a8a53ec232e0eb17e85812d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d56538148e498c2b612ae61ab900fd38ee6b8d3f252f6f2ff3bf72d93c89101d3eed4abe6b6e71f0f28696dcd41716b866416c682d3344e9a0d65ebc4dae786
|
7
|
+
data.tar.gz: de1f16c637b0f366f1a8f3be8cb1d00272c1ade19e5ef340468adc7ebdeab0408d1c0160b34816662504ab92ea10f16aa46b912d4530908838c496cd92f0cd12
|
@@ -24,10 +24,26 @@ module WebsiteInformation
|
|
24
24
|
@params.og.url = doc.css('//meta[property="og:url"]/@content').to_s
|
25
25
|
@params.og.type = doc.css('//meta[property="og:type"]/@content').to_s
|
26
26
|
@params.og.image = doc.css('//meta[property="og:image"]/@content').to_s
|
27
|
+
favicon(doc, url)
|
27
28
|
feed(doc)
|
28
29
|
sns(doc)
|
29
30
|
end
|
30
31
|
|
32
|
+
def favicon(doc, url)
|
33
|
+
favicon = doc.css('//link[@rel="shortcut icon"]/@href').to_s
|
34
|
+
favicon = doc.css('//link[@type="image/x-icon"]/@href').to_s if favicon.empty?
|
35
|
+
favicon = '/favicon.ico' if favicon.empty?
|
36
|
+
|
37
|
+
require 'uri'
|
38
|
+
uri = URI.parse(favicon)
|
39
|
+
if uri.host.nil?
|
40
|
+
uri = URI.parse(url)
|
41
|
+
@params.favicon = "#{uri.scheme}://#{uri.host}#{favicon}"
|
42
|
+
else
|
43
|
+
@params.favicon = favicon
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
31
47
|
def feed(doc)
|
32
48
|
@params.feed = doc.css('//link[@rel="alternate"][@type="application/atom+xml"]/@href')[0].to_s
|
33
49
|
@params.feed = doc.css('//link[@rel="alternate"][@type="application/rss+xml"]/@href')[0].to_s if @params.feed.empty?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: website_information
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miraoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|