metainspector 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/README.md +1 -1
- data/lib/meta_inspector/parser.rb +4 -3
- data/lib/meta_inspector/version.rb +1 -1
- data/spec/fixtures/example.response +26 -0
- data/spec/parser_spec.rb +8 -7
- data/spec/spec_helper.rb +6 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70997114bb41b0923e33d69ff5f0bfacee1c815d
|
4
|
+
data.tar.gz: 2d5e0c677d79ec0f27d3b964a986c6a90b3223f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c5564c900e6a5716e87edd1c2f0d1b077ff197410691de0bb90a9315c5d40c8a34d912d40babdeb0c556b830b36f62f4319d2758b8a95618f62a6e795b17077
|
7
|
+
data.tar.gz: c5bbc6e6587f9ce53c87e9cba683be578d3ff416f10ae260da09946c9c7b683c3254040b72fcc6557bc31bac468efdb3a770f614fa1dfd327cc773d21590a80e
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -41,12 +41,13 @@ module MetaInspector
|
|
41
41
|
@exception_log << e
|
42
42
|
end
|
43
43
|
|
44
|
-
# Returns the parsed document title, from the content of the <title> tag
|
44
|
+
# Returns the parsed document title, from the content of the <title> tag
|
45
|
+
# within the <head> section.
|
45
46
|
# This is not the same as the meta_title tag
|
46
47
|
def title
|
47
|
-
@title ||= parsed.css('title').inner_text rescue nil
|
48
|
+
@title ||= parsed.css('head title').inner_text rescue nil
|
48
49
|
end
|
49
|
-
|
50
|
+
|
50
51
|
# Return favicon url if exist
|
51
52
|
def favicon
|
52
53
|
query = '//link[@rel="icon" or contains(@rel, "shortcut")]'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx/0.7.67
|
3
|
+
Date: Fri, 18 Nov 2011 21:46:46 GMT
|
4
|
+
Content-Type: text/html
|
5
|
+
Connection: keep-alive
|
6
|
+
Last-Modified: Mon, 14 Nov 2011 16:53:18 GMT
|
7
|
+
Content-Length: 4987
|
8
|
+
X-Varnish: 2000423390
|
9
|
+
Age: 0
|
10
|
+
Via: 1.1 varnish
|
11
|
+
|
12
|
+
<html>
|
13
|
+
<head>
|
14
|
+
<title>An example page</title>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<!-- An SVG tag can have a title tag, should not interfere with the head title tag -->
|
18
|
+
<!-- https://github.com/jaimeiniesta/metainspector/issues/83 -->
|
19
|
+
<svg width="500" height="300" xmlns="http://www.w3.org/2000/svg">
|
20
|
+
<g>
|
21
|
+
<title>SVG Title Demo example</title>
|
22
|
+
<rect x="10" y="10" width="200" height="50" style="fill:none; stroke:blue; stroke-width:1px"/>
|
23
|
+
</g>
|
24
|
+
</svg>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/spec/parser_spec.rb
CHANGED
@@ -11,10 +11,6 @@ describe MetaInspector::Parser do
|
|
11
11
|
@m = MetaInspector::Parser.new(doc 'http://pagerankalert.com')
|
12
12
|
end
|
13
13
|
|
14
|
-
it "should get the title" do
|
15
|
-
@m.title.should == 'PageRankAlert.com :: Track your PageRank changes & receive alerts'
|
16
|
-
end
|
17
|
-
|
18
14
|
it "should not find an image" do
|
19
15
|
@m.image.should == nil
|
20
16
|
end
|
@@ -55,7 +51,7 @@ describe MetaInspector::Parser do
|
|
55
51
|
it "should return the document as a string" do
|
56
52
|
@m.to_s.class.should == String
|
57
53
|
end
|
58
|
-
|
54
|
+
|
59
55
|
describe "Feed" do
|
60
56
|
it "should get rss feed" do
|
61
57
|
@m = MetaInspector::Parser.new(doc 'http://www.iteh.at')
|
@@ -72,7 +68,12 @@ describe MetaInspector::Parser do
|
|
72
68
|
@m.feed.should == nil
|
73
69
|
end
|
74
70
|
end
|
75
|
-
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should get the title from the head section" do
|
75
|
+
p = MetaInspector::Parser.new(doc 'http://example.com')
|
76
|
+
p.title.should == 'An example page'
|
76
77
|
end
|
77
78
|
|
78
79
|
describe '#description' do
|
@@ -87,7 +88,7 @@ describe MetaInspector::Parser do
|
|
87
88
|
@m.description.should == "SAN FRANCISCO—In a move expected to revolutionize the mobile device industry, Apple launched its fastest and most powerful iPhone to date Tuesday, an innovative new model that can only be seen by the company's hippest and most dedicated customers. This is secondary text picked up because of a missing meta description."
|
88
89
|
end
|
89
90
|
end
|
90
|
-
|
91
|
+
|
91
92
|
describe '#favicon' do
|
92
93
|
it "should get favicon link when marked as icon" do
|
93
94
|
@m = MetaInspector::Parser.new(doc 'http://pagerankalert.com/')
|
data/spec/spec_helper.rb
CHANGED
@@ -23,7 +23,12 @@ end
|
|
23
23
|
# Faked web responses #
|
24
24
|
#######################
|
25
25
|
|
26
|
-
|
26
|
+
# We're reorganizing fixtures, trying to combine them on as few as possible response files
|
27
|
+
# For each change in the fixtures, a comment should be included explaining why it's needed
|
28
|
+
# This is the base page to be used in the examples
|
29
|
+
FakeWeb.register_uri(:get, "http://example.com/", :response => fixture_file("example.response"))
|
30
|
+
|
31
|
+
# These are older fixtures
|
27
32
|
FakeWeb.register_uri(:get, "http://pagerankalert.com", :response => fixture_file("pagerankalert.com.response"))
|
28
33
|
FakeWeb.register_uri(:get, "http://pagerankalert-shortcut.com", :response => fixture_file("pagerankalert-shortcut.com.response"))
|
29
34
|
FakeWeb.register_uri(:get, "http://pagerankalert-shortcut-and-icon.com", :response => fixture_file("pagerankalert-shortcut-and-icon.com.response"))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metainspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Iniesta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- spec/fixtures/charset_001.response
|
158
158
|
- spec/fixtures/charset_002.response
|
159
159
|
- spec/fixtures/empty_page.response
|
160
|
+
- spec/fixtures/example.response
|
160
161
|
- spec/fixtures/facebook.com.response
|
161
162
|
- spec/fixtures/guardian.co.uk.response
|
162
163
|
- spec/fixtures/https.facebook.com.response
|