curation 1.4 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/curation.rb +23 -15
- data/lib/curation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15ed9203a4164d0cfdfb7e973523008ddfe518ce21016731ae8a1dcddc74b0ab
|
4
|
+
data.tar.gz: e2269fbae2d6a6355f90709409de0fa1dd3e555dfd533b10d00d1073af0ac9ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72df82702be64fcee4e1e7725ecb3c1f831c036040c2ef445388feb493a43cd78b979ed63e99dd0168399c2bd014a0a00e2f7211f561b0ba88f13d0098daaa68
|
7
|
+
data.tar.gz: dd439269683719541f49204484e7d7fd42cbc0f0320e488d2f12a5a36bc472cd343343c4697d0a84a3f8746a308dad03b5e84e33b03adedd3984de73082e5bbb
|
data/Gemfile.lock
CHANGED
data/lib/curation.rb
CHANGED
@@ -61,13 +61,17 @@ module Curation
|
|
61
61
|
return ld['headline'] if ld.has_key? 'headline'
|
62
62
|
end
|
63
63
|
end
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
begin
|
65
|
+
[
|
66
|
+
metainspector.best_title,
|
67
|
+
metainspector.title,
|
68
|
+
nokogiri.css('[itemprop="headline"]')&.first&.inner_text,
|
69
|
+
nokogiri.css('title')&.first&.inner_text
|
70
|
+
].each do |possibility|
|
71
|
+
return possibility unless possibility.blank?
|
72
|
+
end
|
73
|
+
rescue
|
74
|
+
puts 'Curation::Page find_title error'
|
71
75
|
end
|
72
76
|
return ''
|
73
77
|
end
|
@@ -87,11 +91,15 @@ module Curation
|
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
94
|
+
begin
|
95
|
+
[
|
96
|
+
metainspector.images.best,
|
97
|
+
nokogiri.css('[property="og:image"]').first&.attributes['content'].value
|
98
|
+
].each do |possibility|
|
99
|
+
return possibility unless possibility.blank?
|
100
|
+
end
|
101
|
+
rescue
|
102
|
+
puts 'Curation::Page find_image error'
|
95
103
|
end
|
96
104
|
return ''
|
97
105
|
end
|
@@ -107,7 +115,7 @@ module Curation
|
|
107
115
|
@json_ld << hash
|
108
116
|
end
|
109
117
|
rescue
|
110
|
-
puts
|
118
|
+
puts 'Curation::Page json_ld error'
|
111
119
|
end
|
112
120
|
end
|
113
121
|
@json_ld
|
@@ -122,13 +130,13 @@ module Curation
|
|
122
130
|
def nokogiri
|
123
131
|
@nokogiri ||= Nokogiri::HTML html
|
124
132
|
rescue
|
125
|
-
puts
|
133
|
+
puts 'Curation::Page nokogiri error'
|
126
134
|
end
|
127
135
|
|
128
136
|
def metainspector
|
129
137
|
@metainspector ||= MetaInspector.new url, document: html
|
130
138
|
rescue
|
131
|
-
puts
|
139
|
+
puts 'Curation::Page metainspector error'
|
132
140
|
end
|
133
141
|
end
|
134
142
|
end
|
data/lib/curation/version.rb
CHANGED