opengraph_parser 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/open_graph.rb +4 -4
- metadata +14 -14
data/lib/open_graph.rb
CHANGED
@@ -46,17 +46,17 @@ class OpenGraph
|
|
46
46
|
if @response && @response.body
|
47
47
|
doc = Nokogiri.parse(@response.body)
|
48
48
|
|
49
|
-
if @title.to_s.empty? && doc.xpath("//head
|
50
|
-
@title = doc.xpath("//head
|
49
|
+
if @title.to_s.empty? && doc.xpath("//head//title").size > 0
|
50
|
+
@title = doc.xpath("//head//title").first.text.to_s.strip
|
51
51
|
end
|
52
52
|
|
53
53
|
@url = @src if @url.to_s.empty?
|
54
54
|
|
55
|
-
if @description.to_s.empty? && description_meta = doc.xpath("//head
|
55
|
+
if @description.to_s.empty? && description_meta = doc.xpath("//head//meta[@name='description']").first
|
56
56
|
@description = description_meta.attribute("content").to_s.strip
|
57
57
|
end
|
58
58
|
|
59
|
-
fetch_images(doc, "//head
|
59
|
+
fetch_images(doc, "//head//link[@rel='image_src']", "href") if @images.empty?
|
60
60
|
fetch_images(doc, "//img", "src") if @images.empty?
|
61
61
|
end
|
62
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opengraph_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-11-13 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
-
requirement: &
|
17
|
+
requirement: &70142298378460 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70142298378460
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rdoc
|
28
|
-
requirement: &
|
28
|
+
requirement: &70142298377700 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70142298377700
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bundler
|
39
|
-
requirement: &
|
39
|
+
requirement: &70142298396360 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70142298396360
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: jeweler
|
50
|
-
requirement: &
|
50
|
+
requirement: &70142298395860 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70142298395860
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: nokogiri
|
61
|
-
requirement: &
|
61
|
+
requirement: &70142298395360 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70142298395360
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: addressable
|
72
|
-
requirement: &
|
72
|
+
requirement: &70142298394860 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70142298394860
|
81
81
|
description: A simple Ruby library for parsing Open Graph Protocol information from
|
82
82
|
a website. It also includes a fallback solution when the website has no Open Graph
|
83
83
|
information.
|
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
segments:
|
110
110
|
- 0
|
111
|
-
hash:
|
111
|
+
hash: 3188859348820593390
|
112
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|