metainspector 4.4.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 649d8a5db87ec97b74e300e7ac814e390f4a4b06
|
|
4
|
+
data.tar.gz: 60b9fc703dd7a8458d1521e0366ce1b178d328f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af04d3583e5ce43e92a58e11e8ae763d41490220a87de3d92d4bafdfc639cc11027a90371878c478fdbd91dd21c3391a70822064f991f6a0b92ce0ebfa5fcd4b
|
|
7
|
+
data.tar.gz: d48e2fb5b99ce12610fd78195658c51db5daf111e4491cfc726135d37f0176ef7f331f616fbece40d1c4eb184ade8038b7b991bdea5dc4120579a1614d5e8f7c
|
|
@@ -28,7 +28,8 @@ module MetaInspector
|
|
|
28
28
|
# See doc at http://developers.facebook.com/docs/opengraph/
|
|
29
29
|
# If none found, tries with Twitter image
|
|
30
30
|
def owner_suggested
|
|
31
|
-
meta['og:image'] || meta['twitter:image']
|
|
31
|
+
suggested_img = meta['og:image'] || meta['twitter:image']
|
|
32
|
+
URL.absolutify(suggested_img, base_url) if suggested_img
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
# Returns the largest image from the image collection,
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
<meta property="og:image" content="/wp-content/uploads/2015/03/50316106.jpg" />
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<!-- An SVG tag can have a title tag, should not interfere with the head title tag -->
|
|
19
|
+
<!-- https://github.com/jaimeiniesta/metainspector/issues/83 -->
|
|
20
|
+
<svg width="500" height="300" xmlns="http://www.w3.org/2000/svg">
|
|
21
|
+
<g>
|
|
22
|
+
<title>SVG Title Demo example</title>
|
|
23
|
+
<rect x="10" y="10" width="200" height="50" style="fill:none; stroke:blue; stroke-width:1px"/>
|
|
24
|
+
</g>
|
|
25
|
+
</svg>
|
|
26
|
+
|
|
27
|
+
<!-- Internal relative links -->
|
|
28
|
+
<a href="/">Root</a>
|
|
29
|
+
<a href="/faqs">FAQs</a>
|
|
30
|
+
<a href="contact">Contact</a>
|
|
31
|
+
|
|
32
|
+
<!-- Internal absolute links -->
|
|
33
|
+
<a href="http://example.com/team.html">Team</a>
|
|
34
|
+
|
|
35
|
+
<!-- External links -->
|
|
36
|
+
<a href="https://twitter.com">Twitter</a>
|
|
37
|
+
<a href="https://github.com">Github</a>
|
|
38
|
+
|
|
39
|
+
<!-- Non-HTTP links -->
|
|
40
|
+
<a href="mailto:hello@example.com">email</a>
|
|
41
|
+
<a href="javascript:alert('hi');">hello</a>
|
|
42
|
+
<a href="ftp://ftp.example.com">FTP</a>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
@@ -110,6 +110,12 @@ describe MetaInspector do
|
|
|
110
110
|
expect(page.images.owner_suggested).to eq("http://i2.ytimg.com/vi/iaGSSrp49uc/mqdefault.jpg")
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
+
it "should absolutify image" do
|
|
114
|
+
page = MetaInspector.new('http://www.24-horas.mx/mexico-firma-acuerdo-bilateral-automotriz-con-argentina/')
|
|
115
|
+
|
|
116
|
+
expect(page.images.owner_suggested).to eq("http://www.24-horas.mx/wp-content/uploads/2015/03/50316106.jpg")
|
|
117
|
+
end
|
|
118
|
+
|
|
113
119
|
it "should return nil when og:image and twitter:image metatags are missing" do
|
|
114
120
|
page = MetaInspector.new('http://example.com/largest_image_using_image_size')
|
|
115
121
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -39,6 +39,7 @@ FakeWeb.register_uri(:get, "http://example.com/largest_image_using_image_size",
|
|
|
39
39
|
FakeWeb.register_uri(:get, "http://example.com/malformed_image_in_html", :response => fixture_file("malformed_image_in_html.response"))
|
|
40
40
|
FakeWeb.register_uri(:get, "http://example.com/10x10", :response => fixture_file("10x10.jpg.response"))
|
|
41
41
|
FakeWeb.register_uri(:get, "http://example.com/100x100", :response => fixture_file("100x100.jpg.response"))
|
|
42
|
+
FakeWeb.register_uri(:get, "http://www.24-horas.mx/mexico-firma-acuerdo-bilateral-automotriz-con-argentina/", :response => fixture_file("relative_og_image.response"))
|
|
42
43
|
|
|
43
44
|
# Used to test best_title logic
|
|
44
45
|
FakeWeb.register_uri(:get, "http://example.com/title_in_head", :response => fixture_file("title_in_head.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: 4.4.
|
|
4
|
+
version: 4.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jaime Iniesta
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-03-
|
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -289,6 +289,7 @@ files:
|
|
|
289
289
|
- spec/fixtures/protocol_relative.response
|
|
290
290
|
- spec/fixtures/relative_links.response
|
|
291
291
|
- spec/fixtures/relative_links_with_base.response
|
|
292
|
+
- spec/fixtures/relative_og_image.response
|
|
292
293
|
- spec/fixtures/tea-tron.com.response
|
|
293
294
|
- spec/fixtures/theonion-no-description.com.response
|
|
294
295
|
- spec/fixtures/theonion.com.response
|